The purpose of this application is to implicitly activate a separate application to view the URL "http://www.google.com". So, App Chooser should appear and let me choose between at least two browsers: by default, which will show me the site www.google.com and another simple “browser” that just shows me the URL. The problem is that App chooser does not appear when I use implicit activity. Perhaps I wrote the wrong intent filters for the second "simple browser".
private void startImplicitActivation() {
Log.i(TAG, "Entered startImplicitActivation()");
Uri adress = Uri.parse(URL);
Intent intentUrlView = new Intent(Intent.ACTION_VIEW, adress);
Intent chooserIntent = Intent.createChooser(intentUrlView, CHOOSER_TEXT);
Log.i(TAG,"Chooser Intent Action:" + chooserIntent.getAction());
if (intentUrlView.resolveActivity(getPackageManager()) != null) {
startActivity(chooserIntent);
}
}
MANIFESTO
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="course.labs.intentslab.mybrowser"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MyBrowserActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="http" />
<category android:name="android.intent.category.BROWSABLE" />
</activity>
</application>
source
share