2016-05-31 113 views
0

我使用通用圖像加載器將圖像綁定到我的列表視圖中的ImageView。這些圖像是在異步綁定時從聯機url獲取的。現在我想打開圖像點擊ImageView。我如何調用將處理顯示圖像的意圖。我想在用戶的默認圖像查看器應用程序中顯示使用通用圖像加載程序加載的圖像。我有以下代碼可以打開設備上的任何圖像:Android通用圖像加載器意圖

Intent intent = new Intent(); 
intent.setAction(Intent.ACTION_VIEW); 
Uri imgUri = Uri.parse("file://" + yourfilepath); 
intent.setDataAndType(imgUri, "image/*"); 
startActivity(intent); 
+0

檢查[這](http://stackoverflow.com/a/29788893/3117966) – Nisarg

+0

@Nisarg我不想分享圖像,我:那你可以像這樣啓動默認的圖片瀏覽器d喜歡在畫廊中打開圖像。 –

回答

0

圖庫應用程序不接受作爲Intent一部分的圖像的URL。您需要先保存圖像。

Intent intent = new Intent(); 
intent.setAction(Intent.ACTION_VIEW); 
intent.setDataAndType(Uri.parse("file://" + "/sdcard/abc.jpg"), "image/*"); 
startActivity(intent); 
相關問題