我需要从 RecyclerAdapter 共享图像,因为该图像最初并不存在,即使用适配器在 Activity 中加载。如何将位图分享到社交媒体?每次我在应用程序中单击共享时,都会显示“没有应用程序可以执行此操作”。
feedItemView.setFeedSocialShareClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Share to Social Media
ImageView imageView = (ImageView) feedItemView.findViewById(R.id.image);
Drawable mDrawable = imageView.getDrawable();
Bitmap mBitmap = ((BitmapDrawable)mDrawable).getBitmap();
String path = MediaStore.Images.Media.insertImage(context.getContentResolver(),
mBitmap, "Design", null);
Uri uri = Uri.parse(path);
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image");
share.putExtra(Intent.EXTRA_STREAM, uri);
share.putExtra(Intent.EXTRA_TEXT, "I found something cool!");
context.startActivity(Intent.createChooser(share, "Share Your Design!"));
}
});
尝试与
share.setType("image/*");
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)