Sunday, 8 September 2013

How to exclude a specific application from ACTION_VIEW Intent?

How to exclude a specific application from ACTION_VIEW Intent?

I am trying to load a twitter URL in browser. In my phone, I have already
installed twitter app also. I am trying to open URL using ACTION_VIEW
intent. But what happens is, when I call intent, android will show default
chooser dialog, which contains twitter app also(if it is installed on
device). I want to open the URL using browsers only. I want to exclude
twitter application from the dialog. I want all availaible browsers in
device to show up in dialog, not native applications like twitter,
facebook etc. I don't know whether it is possible or not ? If possible
could anyone help me in achieving it. I am also attaching my code and a
screenshot along with this question for better clarity.
String url = "https://twitter.com";
MimeTypeMap map = MimeTypeMap.getSingleton();
String type = map.getMimeTypeFromExtension(url);
Intent i = new Intent(Intent.ACTION_VIEW);
i.setType(type);
i.setData(Uri.parse(url));
startActivity(i);

Exclude twitter app from this dialog. Any help is highly appreciable.
Thanks inAdvance.

No comments:

Post a Comment