简体   繁体   中英

How to open each screenshots folder with my android app?

I have explored my device folders and saw I have two screenshots folders:

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

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

I understand one of them points to built-in Sd card

and the other to extra Sd card I have bout and added to my device.

I'm building an android app that has two buttons:

1) open local screenShots

2) open extra SD screenShots

I have managed to write code only for the first button.

How can I open the second one?

  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));
                }

            }

Try using

getExternalStorageDirectory()

and

getCacheDir()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM