1

I have created a folder in SdCard using a code below:

if (Environment.MEDIA_MOUNTED.equals(state)) {
        // We can read and write the media

        Log.v("Storage","ablo to read and write");
        //create Beatss folder
        File direct = new File(Environment.getExternalStorageDirectory() + "/Beatss");
            boolean success = true;
            if (!direct.exists()) {
                success = direct.mkdir();
            }

I can see that this folder has been created through DDMS. When I connect phone via USB to computer and explore the sdCard i dont see this folder. However, as I mentioned I can see it via DDMS. What is wrong?

Daler
  • 1,205
  • 3
  • 18
  • 39
  • What is the version your device running on? – Kanth Jan 14 '13 at 13:00
  • @Appu, the minSdk for my app is 7. Currently my phone OS.version is 4.0.4. I would like it to work in all versions starting from min-7. – Daler Jan 14 '13 at 13:11

1 Answers1

1

If the device's version which your app is running on is Android 3.0+, you also have to use scanFile() on MediaScannerConnection before it will be actually displayed on a File Explorer of PC. Just refer this for confirmation. If you still have doubts on how to do this, just lemme know, will edit my answer.

Kanth
  • 6,681
  • 3
  • 29
  • 41
  • yes, I read about this, thought it is only for mediaContent not for folders. If you can come out with some really working example, will be much appreciated.Not so many about MediaScanner, so... +1. – Daler Jan 14 '13 at 13:32
  • Sorry, I am not at my system which has Android to test the code and then send it to you, but it did work for me long back. Anyways, have you checked [this](http://stackoverflow.com/questions/4646913/android-how-to-use-mediascannerconnection-scanfile)? Check out all answers, if it didn't, just post your complete code where you actually do this particular thing, will try to work on your code later if I have time. :) – Kanth Jan 14 '13 at 13:47
  • I read that post and run out the second answer with 22 up-posts. When I do `new SingleMediaScanner(this, file);` and passing right elements, nothing happens. I still cant see that folder... I hope you will have some free time.) – Daler Jan 14 '13 at 14:14