I am using the following code to share some text via gmail,facebook,twitter, etc:
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "The status update text");
startActivity(Intent.createChooser(intent, "Dialog title text"));
The thing is that I want to check if the selected intent is Facebook, and if it is, I will do some other coding than prompt the share intent as usual.
Is it possible?
I’ve just found the following link : http://clickclickclack.wordpress.com/2012/01/03/intercepting-androids-action_send-intents/
It describes how to do this kind of task, all you need to do is create a row layout, and you’re done.
I tried it and it works great!
EDIT:
There’s a mistake in the article in the
showfunction, it should be the following:final ShareIntentListAdapter adapter = new ShareIntentListAdapter((Activity)context, R.layout.basiclistview, activities.toArray());Thanks to @imram khan for mentioning that.
If anybody wants to use my xml row layout: