how to check internal and external storage if exist

后端 未结 5 609
说谎
说谎 2020-11-29 04:03

How do i know if there are internal and external storage in android pragmatically? does anyone how to know how to check both internal and external storage

thanks in

5条回答
  •  迷失自我
    2020-11-29 04:22

    I got it working if someone is searching for this.... it will help :D

    try {
                File dir = new File("/mnt/");
                File[] dirs = dir.listFiles();
                for (File _tempDIR : dirs) {
                    String sdCard = _tempDIR.getAbsolutePath().toString();
    
                    File file = new File(sdCard + "/"
                            + Environment.DIRECTORY_DOWNLOADS);
                    File[] files = file.listFiles();
                    if (files != null) {
                        for (int i = 0; i < files.length; i++) {
                            String _temp = files[i].getAbsoluteFile().getName()
                                    .toString();/*Your code, and what you want to find, from all the Sdcard, internal and external. Everything mounted will be found :D*/
    

提交回复
热议问题