作者issuemylove (skill)
看板AndroidDev
標題Re: [問題] 關於在SD卡裡面建立資料夾
時間Wed Mar 12 13:14:56 2014
我大概可能也遇到跟這位大大一樣的問題QQ
我在new htc one上 (4.4.2)建立資料夾時候失敗
可是在其他手機卻成功 orz
那位大大說是手機的問題
那請問要怎樣才能成功建立資料夾呢?
話說htc new one升到4.3以後,Eclipse就讀不到手機了orz
這跟我是用手動安裝APK到手機上有關嗎?
謝謝!
附上程式碼:
public static String getAppDirectory(){
return Environment.getExternalStorageDirectory() + File.separator +
"AppFolder" + File.separator + "images";
}
public static File getOutputMediaFile(Context context){
File mediaStorageDir = new File( getVideoDirectory());
if( !mediaStorageDir.exists()){
if( !mediaStorageDir.mkdirs()){
return null;
}
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 211.21.125.247
... 已解決
http://developer.android.com/guide/topics/manifest/
uses-permission-element.html
這次不是被 android document 陰了就是被 HTC陰了!
明明 document說
”This way, beginning with API level 19, the system will no longer grant your
app the WRITE_EXTERNAL_STORAGE permission.”
htc 4.4.2 api 19 的情況下還是要此 permission啊!
把 permission的 android:maxSdkVersion="18" 拿掉就ok了 G________G"
※ 編輯: issuemylove 來自: 211.21.125.247 (03/12 16:37)
推 sdyy:google指的應該只有getExternalFilesDir() 並不是所有SD空間 03/12 22:21
→ mshockwave:升到4.3之後Eclipse讀不到是因為4.3的adb有進階保護 03/12 22:46
→ mshockwave:插上去之後裝置應該會跳出一個東西 按信任就對了 03/12 22:47
→ issuemylove:沒有耶 囧 我始終沒看到問我信任的dialog 03/13 12:24
→ issuemylove:有甚麼辦法可以主動打開它嗎? 03/13 12:24
推 mshockwave:你電腦端是以最高權限管理者身份嗎? 03/13 20:40
→ issuemylove:Eclipse開啟的時候嗎? 是的 本身windows帳號也是 03/14 09:55
→ issuemylove:系統管理者權限 03/14 09:55
→ c4fun:如果電腦有抓到的話直接cmd打開輸入adb shell應該就會問你了 03/20 19:48