Eduardo Melnik
Eduardo Melnik

Reputation: 3

Android implicit Intent chooser to display Activities that are capable of viewing URLs

I'm trying to create a chooser intent to display activities that are capable of viewing URL's. The first activity should be the Web Browser and the second activity should be a custom created activity I created call "MyBrowser".

When I run the code, no activities match my Intent. Here's how I'm calling the Implicit Intent:

Intent baseIntent = new Intent(Intent.ACTION_SEND, Uri.parse(URL));
Intent chooserIntent = Intent.createChooser(baseIntent, CHOOSER_TEXT);
if (baseIntent.resolveActivity(getPackageManager()) != null) {
            startActivity(chooserIntent);
}

Here is my intent-filter for my custom Browser Activity:

<intent-filter>
       <action android:name="android.intent.action.VIEW" />
       <category android:name="android.intent.category.DEFAULT" />
       <data android:scheme="http" />
</intent-filter>

Upvotes: 0

Views: 537

Answers (1)

Blundell
Blundell

Reputation: 76506

I believe it should be Intent.ACTION_VIEW not Intent.ACTION_SEND to browse web pages.

http://developer.android.com/reference/android/content/Intent.html#ACTION_VIEW

Upvotes: 1

Related Questions