【发布时间】:2020-10-18 13:59:07
【问题描述】:
我正在尝试使用意图共享图像。请找到相同的功能。
if(view.getId()==R.id.sendImage){
Uri imgUri=Uri.parse("android.resource://com.example.watchyalist/mipmap/"+R.mipmap.test);
intent=new Intent(Intent.ACTION_SEND);
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_STREAM,imgUri);
intent.putExtra(intent.EXTRA_TEXT,"Please find the image");
chooser=Intent.createChooser(intent,"Choose the app");
startActivity(chooser);
}
这里的测试是我指的图像,它通过whatsapp共享时发送bin文件。我尝试使用 ic_launcher,然后它说共享失败。这是我的清单文件的快照
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
我无法理解。我尝试将清单标签更改为可绘制并因此将图像保持为可绘制并相应地进行更改仍然没有运气。我已将图像保存在项目的 mipmap-anydpi-v26 文件夹中,并且还尝试更改位置但没有用。有人可以帮忙吗?谢谢!
【问题讨论】:
标签: android image android-intent