Google+应用在通过Android分享时显示错误的图片

时间:2014-03-01 16:13:34

标签: android google-plus

我已通过编程方式将Google+分享添加到了我的应用中。我有一组照片,包含在帖子中,并与以下代码共享:

private void shareToGooglePlus() {
  // Launch the Google+ share dialog with attribution to your app.
  PlusShare.Builder share = new PlusShare.Builder(this);

  for (String imageFilename : imageList) {
    Uri imageUri = Uri.fromFile(new File(imageFilename));
    share.addStream(imageUri);
  }

  share.setText("My images");
  share.setType("image/jpeg");

  startActivityForResult(share.getIntent(), 0);
}

执行此代码后,我的手机上的Google+应用就会启动,我会按预期获得包含图片和文字的预览。

但是,如果我多次运行此操作并在后续运行中包含不同的图像,则原始图像会显示在Google+信息预览中而不是新信息中。如果我提交帖子,则会在帖子中显示正确的图片 - 新图片,而不是原始图片。

我认为Google+应用有某种缓存机制。有没有办法以编程方式清除该缓存,以便在Google+应用后期预览中显示正确的图片?

提前完成。

1 个答案:

答案 0 :(得分:4)

尝试在每次运行中为源文件指定不同的随机名称(通过重命名或复制)