12
我使用ACTION_PICK
意圖從圖庫中選擇圖像。一些相冊如「帖子」,「個人資料照片」等都標有Picasa圖標。對於從這樣的專輯圖片,我得到一個URI與此類似:如何從URI加載Picasa圖像?
content://com.google.android.gallery3d.provider/picasa/item/5769844615871490082
我可以用ContentResolver
和BitmapFactory
沒有問題加載此URI的圖像:
final InputStream ist = context.getContentResolver().openInputStream(intent.getData());
final Bitmap bitmap = BitmapFactory.decodeStream(ist);
但我無法加載重新啓動應用程序後使用存儲的URI映像。我得到這個當decodeStream()
叫做:
03-11 12:34:56.502: A/libc(1172): Fatal signal 11 (SIGSEGV) at 0x00000408 (code=1), thread 1462 03-11 12:34:56.502:
W/ActivityManager(478): Permission Denial: opening provider
com.android.gallery3d.provider.GalleryProvider from
ProcessRecord{41cdd220 1172:com.mycompany.myapp/u0a10085}
(pid=1172, uid=10085) requires
com.google.android.gallery3d.permission.GALLERY_PROVIDER or
com.google.android.gallery3d.permission.GALLERY_PROVIDER
我試圖
<uses-permission android:name="com.google.android.gallery3d.permission.GALLERY_PROVIDER"/>
添加到清單文件,但它並沒有幫助。
我認爲我的問題類似於this one,但沒有給出解決方案,只有解決方法。是否可以請求訪問存儲的URI的權限?
內容-URI是最有可能的時間限制,只有在ACTION_PICK方面所作的工作。您需要將圖像緩存到您的應用中,因爲不能保證內容在以後可用。 – 323go 2013-03-11 03:21:34
我發誓我即使戈納遇到同樣的問題,最喜歡 – JRowan 2013-03-11 03:27:37
你有沒有找到這個解決方案?我面臨同樣的問題。 – 2013-09-19 06:43:03