Implicit Intents

When using implicit intents, we have to check at least one app has to be there in the device to handle the intent. The way to check the sendIntent is,



Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, textMessage);
sendIntent.setType(HTTP.PLAIN_TEXT_TYPE); // "text/plain" MIME type
startActivity(sendIntent);


if (sendIntent.resolveActivity(getPackageManager()) != null) {
   startActivity(sendIntent);
} 



Comments

Popular posts from this blog

AlarmManager and Notification in Android

Open Gallery and get the selected image in appplication

Dismiss or Cancel dialog by swipe gesture