我成功地将我的应用程序添加到 Android 库的“共享”按钮中,所以如果我点击它,我的应用程序就会启动。我可以选择启动我的应用程序的哪个活动吗?现在它开始了“主要”。这是我在主类中的代码:
.....
Intent intent = getIntent();
Bundle extras = intent.getExtras();
String action = intent.getAction();
// if this is from the share menu
if (Intent.ACTION_SEND.equals(action)) {
if (extras.containsKey(Intent.EXTRA_STREAM)) {
// Get resource path
}
}
和清单:
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
实际上,我在“主要”开始后立即成功地打开了一个新活动,但我更喜欢直接打开正确的活动。谢谢