小编Nin*_*ica的帖子

getExternalStorageDirectory()到getExternalFilesDir()

所以,基本上我有这个代码(所有信用到mburhman的文件资源管理器 - https://github.com/mburman/Android-File-Explore):

private File path = new File(Environment.getExternalStorageDirectory() + "");

protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.start);

    loadFileList();

    showDialog(DIALOG_LOAD_FILE);

    Log.d(TAG, path.getAbsolutePath());

    readDir = (Button) findViewById(R.id.btnReadDirectory);

    readDir.setOnClickListener(this);
}
private void loadFileList() {
    try {
        path.mkdirs();
    } catch (SecurityException e) {
        Log.e(TAG, "unable to write on the sd card ");
    }

    if (path.exists()) {
        FilenameFilter filter = new FilenameFilter() {

            @Override
            public boolean accept(File dir, String filename) {
                // TODO Auto-generated method stub
                File sel …
Run Code Online (Sandbox Code Playgroud)

java eclipse android

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1

eclipse ×1

java ×1