봅니다 파일을 디렉토리를 사용할 수 있는지 확인하고있는 다음 코드를 사용합니다 :
String Directory = "";
String[] mFileList ;
//GET ROOT DIRECTORY OF EXTERNAL STORAGE + DIRECTORY THAT YOU WANT
File dir = new File(Environment.getExternalStorageDirectory() + DIRECTORY);
if(dir.exists()) {
mFileList = dir.list(filter);
if(mFileList.length==0)
//Inform that directory is empty
}
else {
//Inform user that there is no such directory
}
는 그런 다음 대화 열 수 있습니다
Dialog dialog = null;
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(this, android.R.style.Theme_Holo));//this, R.style.AlertDialogCustom));
builder.setTitle("Choose your file");
if(mFileList == null) {
//Log.e(TAG, "Showing file picker before loading the file list");
dialog = builder.create();
}
builder.setItems(mFileList, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
mChosenFile = mFileList[which];
//Do something after choosing the file
}
});
dialog = builder.show();
return true;
를 내가 당신을 도움이되기를 바랍니다.
마렉도 마찬가지였습니다. 아래의 대화는 무엇을 말합니까? – newBie
이 대화 상자는 특정 폴더의 모든 파일을 표시합니다. If는 선택한 파일 이름을 반환합니다. 나중에이 파일 이름을 사용할 수 있습니다. – Marek