2015-11-07 133 views
1

我正在使用通用圖像加載程序在我的應用程序中顯示圖像。有圖像共享功能與其他應用程序共享圖像。通用圖像加載程序與其他應用程序共享圖像

現在我做:

ImageLoader imageLoader = ImageLoader.getInstance(); 
File file = imageLoader.getDiskCache().get(url); 
if (file != null) { 
    Util.shareImage(getActivity(), file); 
} 

public static void shareImage(Context context, File pictureFile) { 
    Uri imageUri = Uri.parse(pictureFile.getAbsolutePath()); 
    Intent shareIntent = new Intent(); 
    shareIntent.setAction(Intent.ACTION_SEND); 
    shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri); 
    //shareIntent.setType("image/jpeg"); 
    shareIntent.setType("image/*"); 
    context.startActivity(Intent.createChooser(shareIntent, "Share")); 
} 

下面是變量的值。

enter image description here

不知道爲什麼它不工作?

回答

0

嘗試「靜態」放棄

public void shareImage(Context context, File pictureFile) { 
Uri imageUri = Uri.parse(pictureFile.getAbsolutePath()); 
    Intent shareIntent = new Intent(); 
    shareIntent.setAction(Intent.ACTION_SEND); 
    shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri); 
} 
+0

不工作:/ –

0

我錯過了這個權限,這似乎是需要能夠共享圖像

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
相關問題