2013-10-05 33 views
0

我已经探讨我的设备文件夹,看到我有两个screenshots文件夹:如何用我的android应用程序打开每个截图文件夹?

//storage/sdcard0/pictures/Screenshots/ ...

//storage/extSdCard/DCIM/Screenshots/ ...

我理解他们的一个指向内置SD卡

,另一个额外的SD卡我有回合并添加到我的设备。

我建立一个有两个按钮,一个Android应用程序:

1)打开本地截图

2)开放额外的SD截图

我已成功地只对第一个按钮编写代码。

如何打开第二个?

private void GetWithFileExplorer() 
      { 
       File dir = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Pictures/Screenshots"); 
       Log.d("File path ", dir.getPath()); 
       String dirPath=dir.getAbsolutePath(); 
       if(dir.exists() && dir.isDirectory()) { 
        Intent intent = new Intent(Intent.ACTION_PICK, null); 
        intent.setType("image/*"); 
        intent.setData(Uri.fromFile(dir)); 

        Log.d("b4performSpecificCrop_startActivityForResult::", Integer.toString(3)); 
        startActivityForResult(intent, 3); 
        Log.d("afterperformSpecificCrop_startActivityForResult::", Integer.toString(3)); 
       } 

      } 

回答

0

使用

getExternalStorageDirectory() 

getCacheDir() 
尝试
相关问题