[英]Provide other apps to share image with my app and open/use it
I just read other question like this .But when I am trying to get image path or uri its getting null value. 我刚刚看了像其他的问题这个 。但是当我试图让图像路径或URI它越来越空值。
Here is may manifest code: 这是可能的清单代码:
<activity
android:name=".design.MyActivity"
android:configChanges="orientation|screenSize"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="*" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
And I am handling intent from MyActivity.java : 我正在从MyActivity.java处理意图:
final Intent intent = getIntent();
final String action = intent.getAction();
if (Intent.ACTION_SEND.equals(action)) {
Log.i("ImagePath>>>", intent.getData() + "");
}
Log showing ImagePath>>>null 日志显示ImagePath >>> null
OK! 好! I am sorry to late but you can get image path by using: 抱歉,您可以使用以下方法获取图像路径:
Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
May be this question helps other people! 可能这个问题可以帮助其他人! : ) :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.