【发布时间】:2017-07-11 09:14:35
【问题描述】:
我正在尝试使用我的 Android 应用在我的 Instagram 上分享图片。但是图像共享完成后我无法获得成功。 我使用了 Intent 过程,但在图像共享完成时我无法获得成功。
Intent share = new Intent(Intent.ACTION_SEND);
// Limit this call to instagram
share.setPackage("com.instagram.android");
// Set the MIME type
share.setType("image/jpg");
// Create the URI from the media
File media = new File("/storage/emulated/0/DCIM/Camera/IMG_20170627_222256129_HDR.jpg");
Uri uri = Uri.fromFile(media);
// Add the URI to the Intent.
share.putExtra(Intent.EXTRA_STREAM, uri);
try {
// Fire the Intent.
startActivityForResult(share, REQUEST_CODE);
} catch(ActivityNotFoundException e) {
// instagram not installed
}
【问题讨论】:
标签: android instagram instagram-api