當前位置:首頁 » 安卓系統 » android獲取存儲卡路徑

android獲取存儲卡路徑

發布時間: 2023-03-29 14:11:07

Ⅰ Android 獲取手機內部存儲的路徑

方法有許多··
推薦: 用電腦開,方法如下電腦手機都安裝騰訊 應用寶軟體 然後手機連接電腦 打開電腦上的應用寶 可以直接 查看手機內存路徑信息
其他辦法:安裝第三方系統工具,可以直接查看內存信息,這個方法可以取眾多的安卓下載平台獲取

Ⅱ 獲取android手機的自帶存儲路徑和sdcard存儲路徑

android手機獲取自帶存儲來路徑和sd卡存儲路徑的方式是:調用Environment.getExternalStorageDirectory(),返回的存儲源目錄並不是系統內置的SD卡目錄。
1.一部分手機將eMMC存儲掛載到
/mnt/external_sd
、/mnt/sdcard2
等節點知,而將外置的SD卡掛載到
Environment.getExternalStorageDirectory()這個結點。
此時,調用Environment.getExternalStorageDirectory(),則返回外置的SD的路徑。
2.而另一部分手機直接道將eMMC存儲掛載在Environment.getExternalStorageDirectory()這個節點,而將真正的外置SD卡掛載到/mnt/external_sd、/mnt/sdcard2
等節點。
此時,調用Environment.getExternalStorageDirectory(),則返回內置的SD的路徑。

Ⅲ android 如何獲取系統內置的存儲空間路徑

自己創建一個文件(一個工具類),設置它的路徑
下面是一段檢查SDCard有沒有這個文件夾沒有就創建一個if(checkSDCard())
{
filePath
=
Environment.getExternalStorageDirectory()+File.separator+"aishop";
}else{
filePath
=
context.getCacheDir().getAbsolutePath()+File.separator+"aishop";
}路徑自己設置就可以了

安卓手機sd卡的路徑在哪

sd卡路徑的確是在/mnt sdcard,不過請注意下載游戲安裝玩是無法安裝在sd卡里,也就是說你安裝了還是在手機內存里,游戲運行時是佔用手機內存的,建議你試試用電腦把數據包下載在手機sd卡里,如果還是提醒內存不足就卸載掉點東西吧。

(4)android獲取存儲卡路徑擴展閱讀:

SD存儲卡是一種基於半導體快閃記憶器的新一代記憶設備,由於它體積小、數據傳輸速度快、可熱插拔等優良的特尺盯亮性,被廣泛地於攜帶型裝置上使用,例如數碼相機、個人數碼助理(外語縮寫PDA)和多媒體播放器等。

SD卡是由松下電器、東芝和SanDisk聯合推出,1999年8月發布。SD卡的數據傳送和物理規范由MMC發陵寬展而來,大小和MMC卡差不多,尺寸為32mm x 24mm x 2.1mm。長寬和MMC卡一樣,只是比則巧MMC卡厚了0.7mm,以容納更大容量的存貯單元。

S與 MMC 卡保持著向上的兼容,MMC卡可以被新的SD設備存取,兼容性則取決於應用軟體,但SD卡卻不可以被MMC設備存取。

參考資料:SD卡-網路

Ⅳ Android開發中,獲取U盤或SD卡路徑。

@SuppressLint("PrivateApi")

    private String getStoragePath(Context context, boolean isUsb){

        String path="";

        StorageManager mStorageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);

        Class<?> volumeInfoClazz;

        Class<?> diskInfoClaszz;

        try {

            volumeInfoClazz = Class.forName("android.os.storage.VolumeInfo");

            diskInfoClaszz = Class.forName("android.os.storage.DiskInfo");

            Method StorageManager_getVolumes=Class.forName("android.os.storage.StorageManager").getMethod("getVolumes");

            Method VolumeInfo_GetDisk = volumeInfoClazz.getMethod("getDisk");

            Method VolumeInfo_GetPath = volumeInfoClazz.getMethod("getPath");

            Method DiskInfo_IsUsb = diskInfoClaszz.getMethod("isUsb");

            Method DiskInfo_IsSd = diskInfoClaszz.getMethod("isSd");

            List<Object> List_VolumeInfo = (List<Object>) StorageManager_getVolumes.invoke(mStorageManager);

            assert List_VolumeInfo != null;

            for(int i=0; i<List_VolumeInfo.size(); i++){

                Object volumeInfo = List_VolumeInfo.get(i);

                Object diskInfo = VolumeInfo_GetDisk.invoke(volumeInfo);

                if(diskInfo==null)continue;

                boolean sd= (boolean) DiskInfo_IsSd.invoke(diskInfo);

                boolean usb= (boolean) DiskInfo_IsUsb.invoke(diskInfo);

                File file= (File) VolumeInfo_GetPath.invoke(volumeInfo);

                if(isUsb == usb){//usb

                    assert file != null;

                    path=file.getAbsolutePath();

                }else if(!isUsb == sd){//sd

                    assert file != null;

                    path=file.getAbsolutePath();

                }

            }

        } catch (Exception e) {

            YYLog.print(TAG, "[——————— ——————— Exception:"+e.getMessage()+"]");

            e.printStackTrace();

        }

        return path;

    }

Ⅵ android開發想得到sd卡路徑

通過正規api得不到外卡路徑.

谷歌在源碼中給出了得到外卡路徑的方法,但標記為隱藏介面,因此api無法訪問.

可以通過反射介面得到:

java">importjava.lang.reflect.Method;
importandroid.os.storage.StorageManager;

(){
try{
StorageManagersm=(StorageManager)getSystemService(STORAGE_SERVICE);
MethodgetVolumePathsMethod=StorageManager.class.getMethod("getVolumePaths",null);
String[]paths=(String[])getVolumePathsMethod.invoke(sm,null);
//firstelementinpaths[]isprimarystoragepath
returnpaths[0];
}catch(Exceptione){
Log.e(TAG,"getPrimaryStoragePath()failed",e);
}
returnnull;
}

(){
try{
StorageManagersm=(StorageManager)getSystemService(STORAGE_SERVICE);
MethodgetVolumePathsMethod=StorageManager.class.getMethod("getVolumePaths",null);
String[]paths=(String[])getVolumePathsMethod.invoke(sm,null);
//secondelementinpaths[]issecondarystoragepath
returnpaths[1];
}catch(Exceptione){
Log.e(TAG,"getSecondaryStoragePath()failed",e);
}
returnnull;
}

publicStringgetStorageState(Stringpath){
try{
StorageManagersm=(StorageManager)getSystemService(STORAGE_SERVICE);
MethodgetVolumeStateMethod=StorageManager.class.getMethod("getVolumeState",newClass[]{String.class});
Stringstate=(String)getVolumeStateMethod.invoke(sm,path);
returnstate;
}catch(Exceptione){
Log.e(TAG,"getStorageState()failed",e);
}
returnnull;
}

如果樓主有源碼,可以去找StorageManager這個類,拉到文件最下方,就可以看到那三個隱藏介面.

Ⅶ android開發內置存儲設備外置SD卡的路徑怎麼獲取

方法:1點擊手機的文件管理2點擊上方的本地選項3顯示內部儲存的是自帶儲存路徑,SD卡位sdcard的儲存路徑

Ⅷ android4.0後怎麼獲取sdcard的路徑(包括外置和內置的)

getExternalStorageDirectory()方法在4.0以後只能獲取內置SD卡路徑
外置SD卡
/**
* 獲取外置SD卡路徑
* @return 應該就一條記錄或空
*/
public List<string> getExtSDCardPath()
{
List<string> lResult = new ArrayList<string>();
try {
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("mount");
InputStream is = proc.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null) {
if (line.contains("extSdCard"))
{
String [] arr = line.split(" ");
String path = arr[1];
File file = new File(path);
if (file.isDirectory())
{
lResult.add(path);
}
}
}
isr.close();
} catch (Exception e) {
}
return lResult;
}

List<string> extPaths = getExtSDCardPath();
for (String path : extPaths) {
log.append("外置SD卡路徑:" + path + "\r\n");
}

PS別忘記添加許可權,內外置SD卡的許可權在4.0以後是不一樣的

Ⅸ Android之獲取內、外置存儲器路徑

Android SDK提供了大量的介面獲取存儲器路徑,而存儲器分為 內置存儲器 和 外或歷昌置存儲器 ,下面分類列表獲取路徑的介面。

簡單分析:

簡單分爛禪析:

簡單分析:

簡單分析:

簡單分析:

簡單分析:

簡單分析:

簡單分衫扒析:

簡單分析:

簡單分析:

簡單分析:

簡單分析:

簡單分析:

簡單分析:

簡單分析:

簡單分析:

簡單分析:

簡單分析:

簡單分析:

簡單分析:

以下是我整理的工具類

Ⅹ Android得到的真機的SD卡路徑是 /storage/emulated/0/,該怎麼解決

這是引用路徑,別擔心。
打開你的ddms File Explorer
你可以在你的mnt/sdcard後面看到一列info列
裡面寫的就是類似於/storage/emulated/0/這個東西
然後你可以在你的File Explorer中找到storage文件夾,下面就會有emulated,然後下面會有0
其實都是一樣的

熱點內容
1970linux 發布:2025-07-05 12:12:43 瀏覽:107
解壓挑刺 發布:2025-07-05 12:12:12 瀏覽:535
rarlinux壓縮 發布:2025-07-05 12:08:52 瀏覽:398
手機點菜app怎麼連接電腦伺服器 發布:2025-07-05 11:13:05 瀏覽:943
配置控制台干什麼用的 發布:2025-07-05 10:54:51 瀏覽:962
連信從哪裡改登錄密碼 發布:2025-07-05 10:54:12 瀏覽:399
怎麼修改查詢密碼 發布:2025-07-05 10:49:48 瀏覽:967
matlab文件存儲 發布:2025-07-05 10:40:46 瀏覽:85
梅州市用工實名制管理平台雲存儲 發布:2025-07-05 10:28:59 瀏覽:77
安卓origin怎麼設置 發布:2025-07-05 10:20:10 瀏覽:543