这是我的代码:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.sharebutton:
shareImage();
break;
default:
return super.onOptionsItemSelected(item);
}
return true;
}
private void shareImage() {
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/*");
String imagePath = Environment.getExternalStorageDirectory()
+ "/myImage.png";
File imageFileToShare = new File(imagePath);
Uri uri = Uri.fromFile(imageFileToShare);
share.putExtra(Intent.EXTRA_STREAM, uri);
Bitmap bmp = BitmapFactory.decodeFile(imagePath);
startActivity(Intent.createChooser(share, "Share"));
}
我正在尝试分享我的图像,但它没有分享。我没有错误。谁能告诉我有什么问题?