Intent intent android studio code example

Example 1: share intent android

Intent shareIntent = new Intent(Intent.ACTION_SEND);
            shareIntent.setType("text/plain");
            shareIntent.putExtra(Intent.EXTRA_SUBJECT, "My application name");
            String shareMessage = "\n" + tvBlogTitle.getText().toString()+ "\n\n";
            shareMessage = shareMessage + bundle.getString("link") + "\n\n";
            shareIntent.putExtra(Intent.EXTRA_TEXT, shareMessage);

            startActivity(Intent.createChooser(shareIntent, "choose one"));

Example 2: intent android

Intent intent = new Intent(MainActivity.this,Activity.class);

Tags:

Java Example