如何在android中共享google plus上的http url图像?
我想与google plus个人资料共享一张在线图像。在我的应用程序中,我现在得到了图片url,我想在google plus个人资料上分享它如何在android中共享google plus上的http url图像?,android,google-plus,Android,Google Plus,我想与google plus个人资料共享一张在线图像。在我的应用程序中,我现在得到了图片url,我想在google plus个人资料上分享它 File tmpFile = new File("/path/to/image"); final String photoUri = MediaStore.Images.Media.insertImage( getContentResolver(), tmpFile.getAbsolutePath(), null, null);
File tmpFile = new File("/path/to/image");
final String photoUri = MediaStore.Images.Media.insertImage(
getContentResolver(), tmpFile.getAbsolutePath(), null, null);
Intent shareIntent = ShareCompat.IntentBuilder.from(this)
.setText("Hello from Google+!")
.setType("image/jpeg")
.setStream(Uri.parse(photoUri))
.getIntent()
.setPackage("com.google.android.apps.plus");
下面是从url下载图像的代码
try {
URL url = new URL(link);
HttpURLConnection connection = (HttpURLConnection) url
.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
return myBitmap;
} catch (IOException e) {
e.printStackTrace();
Log.e("getBmpFromUrl error: ", e.getMessage().toString());
return null;
}
我已从设备中读取以共享。这个链接可以下载并共享。我不想下载itI我想共享Web上的图像您需要下载图像然后共享。我只能下载图像而不是本地保存然后共享吗?您可以下载-->保存-->共享-->删除图像。