안드로이드 개발 질문/답변
(글 수 45,052)
google 소스를 보니
/**
* returns the FAT file system volume ID for the volume mounted at the given
* mount point, or -1 for failure
*
* @param mount
* point for FAT volume
* @return volume ID or -1
*/
public static native int getFatVolumeId(String mountPoint);
{
.....................
}
이런게 있는데요..
sdcard id 값을 return하는 함수 인데..
sdcard id값을 어떻게 얻을수 있죠??
아시는 분 답변 좀 부탁 드릴께요~~
/**
* returns the FAT file system volume ID for the volume mounted at the given
* mount point, or -1 for failure
*
* @param mount
* point for FAT volume
* @return volume ID or -1
*/
public static native int getFatVolumeId(String mountPoint);
{
.....................
}
이런게 있는데요..
sdcard id 값을 return하는 함수 인데..
sdcard id값을 어떻게 얻을수 있죠??
아시는 분 답변 좀 부탁 드릴께요~~
2010.06.07 13:11:32
위 Api는 sdk에 포함되지 않은 non-public 코드로 app에선 사용할 수 없습니다.
android.os.Environment의 getExternalStorageDirectory()를 통해 sdcard에 대한 File object를
얻어 처리를 하셔야 할 것 같습니다.
2010.06.07 13:39:55
위에서도 언급을 했듯이 public api가 아니어서 사용하지 않는 것이 좋을듯 합니다.
하지만 굳이 사용을 하셔야 한다면 아래의 방법을 적용하시면 sdcard의 id을 얻어 올 수 있습니다.
작업하시는 프로젝트에
package android.os;
public class FileUtils{
public static native int getFatVolumeId(String mountPoint);
}
를 추가하시면, runtime시에 해당 api의 native 코드를 사용하여 id 값을 리턴해줍니다.
app에서 해당 api 호출 방법
int id = FileUtils.getFatVolumeId(Environment.getExternalStorageDirectory().getPath());



