我用下面的鏈接集成攝像頭在我的應用程序打開相機並使用FileProvider無法保存圖像。收到錯誤:W/ContextImpl:無法保證目錄:
https://developer.android.com/training/camera/photobasics.html#TaskScalePhoto
我也跟着每一步,但我得到以下錯誤,每當試圖把圖片來源攝像頭和一個對話框也會彈出顯示
錯誤 「不幸的是,相機已經停止」:
W/ContextImpl: Failed to ensure directory: /storage/extSdCard/Android/data/com.example.daf.formvalidator/files/Pictures
E/OpenGLRenderer: SFEffectCache:clear(), mSize = 0
什麼奇怪,我在下面的代碼返回(從上面的鏈接所)在storageDir 的價值和上面的錯誤「/模擬/ 0」表示「extSdCard」
// returns /storage/emulated/0/Android/data/com.example.daf.formvalidator/files/Pictures/
File storageDir = getActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);
我想要什麼?
-open camera app。
-store拍照到應用程序的私人存儲正如鏈接中所述。
-want使用FileProvider
我也試圖與諸如意圖設置標誌:
takePictureIntent.setFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
我無法找到問題,並花了差不多1天發現的問題。 請提供任何形式的幫助。這將不勝感激。
爲什麼「storageDir的值」和錯誤信息有區別?
如果問題不明確,請建議...
已經嘗試過這種 –