728x90
파일 Path 정보 중 USB의 루트 디렉토리 이름을 구해와야 하는 일이 생겼다.
VolumeLabel 이라고 하던데, 가져오는 방법은 다음과 같은 방법으로 구해올 수 있다.
public String getUsbUUIDName(Context context){
StorageManager storage = (StorageManager) context.getSystemService(STORAGE_SERVICE);
List<StorageVolume> volumes = storage.getStorageVolumes();
for (StorageVolume volume : volumes) {
if (albumName.equals(volume.getUuid())){
return volume.getUuid();
}
}
return null;
}
참조 : https://stackoverflow.com/questions/54348807/android-usbmanager-retrieve-usb-drive-name
728x90
'Mobile > Android' 카테고리의 다른 글
[Android] HashMap vs ArrayMap 비교 (0) | 2022.11.14 |
---|---|
[Android] APK Push 할 때 read only 오류 메시지 대응 방법 (0) | 2022.10.31 |
[Android] call stack 로그 추출 방법 (0) | 2022.08.30 |
[Android] Popup(Dialog) 떠있는 상태에서 내부 값 변경 (0) | 2022.08.24 |
[Andoroid] 안드로이드에서 Html 파일 처리 (0) | 2022.06.21 |
댓글