Posts

Showing posts from February, 2013

Customize your ACTION_CHOOSER Intent

For an Android Intent chooser, it is possible to either remove an Intent or add an custom Intent, this is how we do it: List < Intent > targetedShareIntents = new ArrayList < Intent >(); Intent intent = new Intent ( Intent.ACTION_SEND ); intent.setType( "text/plain" ); intent.putExtra( Intent.EXTRA_TEXT , "http://www.blogspot.com" ); List < ResolveInfo > resInfo = t his .getPackageManager().queryIntentActivities(intent, 0); for ( ResolveInfo resolveInfo : resInfo) {     String packageName = resolveInfo.activityInfo.packageName;     Intent targetedShareIntent = new Intent ( android.content.Intent.ACTION_SEND );    targetedShareIntent.setType( "text/plain" );    targetedShareIntent.putExtra( Intent.EXTRA_TEXT , "http://www.blogspot.com" );    targetedShareIntent.setPackage(packageName);     if (!packageName.equals( "com.facebook.katana" )) { // Remove Facebook Intent share   ...