Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何让我的应用程序记住收件人和调用它的应用程序?_Android_Image_Android Intent_Share_Whatsapp - Fatal编程技术网

Android 如何让我的应用程序记住收件人和调用它的应用程序?

Android 如何让我的应用程序记住收件人和调用它的应用程序?,android,image,android-intent,share,whatsapp,Android,Image,Android Intent,Share,Whatsapp,我正在应用程序中共享图像 由于此代码: <intent-filter> <action android:name="android.intent.action.GET_CONTENT" /> <category android:name="android.intent.category.OPENABLE" /> <category android:name="android.intent.category.DEFAULT" />

我正在应用程序中共享图像

由于此代码:

<intent-filter>
   <action android:name="android.intent.action.GET_CONTENT" />
   <category android:name="android.intent.category.OPENABLE" />
   <category android:name="android.intent.category.DEFAULT" />
   <data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
   <action android:name="android.intent.action.PICK" />
   <category android:name="android.intent.category.DEFAULT" />
   <data android:mimeType="image/*" />
</intent-filter>

我可以从Whatsapp附件屏幕打开我的应用程序。 问题是整个应用程序都被打开了。当我选择图像时,该应用程序为我提供了在其他不同应用程序中共享的选项。 我想让我的申请书记住我从whatsapp打电话,收件人是谁(我打开时他正在和我聊天)。 可能吗

对不起我的英语。
提前感谢。

通过比较它们的组件(如果您设置)/action/category/type/data值,意图仅与意图过滤器匹配。 因此,如果您想要应用程序,只需选择您想要的应用程序,只需如下设置组件/类:

setClass(xxActivity.this,xxActivity.class);
这样,它就会开始某项活动。操作/类别/类型/数据将被忽略

但是,在知道活动细节的前提下,上述解决方案会很好地工作,而您不知道
whatsapp
的细节


也就是说,你不能只让whatsapp收到这个意图

我不明白,你不是应该简单地使用
setResult
finish
你的活动,而不是再次尝试打开whatsapp吗?