私はAndroidでコースを受講していますが、タスクがあります。そのうちの1つは、別のプログラムが暗黙のインテントを送信した場合にセレクターに表示できるように提供する「MyBrowser」と呼ばれるプログラムを作成することです。そしてこれを見つけました:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="andoid.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
</intent-filter>
最初のインテント フィルターは既にファイルにあり、2 番目のフィルターを追加しましたが、機能せず、その理由がよくわかりません。暗黙のインテントは次のようになります。
private void startImplicitActivation() {
Uri webpage = Uri.parse("http://www.google.com");
Intent baseIntent = new Intent (Intent.ACTION_VIEW, webpage);
Intent chooserIntent = Intent.createChooser(baseIntent, "Choose application");
startActivity(chooserIntent);
}
それが私が開こうとした唯一の意図です。
前もって感謝します。