Skip to content Skip to sidebar Skip to footer

Display Media Files In Listview, Nullpointerexception?

MainActivity public class MainActivity extends Activity { /** Called when the activity is first created. */ private List myList; File file; @Override public void o

Solution 1:

The probem was that "/Test" directory does not exist, so i replaced it with "/Bluetooth" (which is a dir that exists) , and now it displays a list of files in that folder.

Problem solved. :D

    Log.i("MEDIA", "C");
    File directory = Environment.getExternalStorageDirectory();
    file = new File(directory+ "/Bluetooth");// + "/Test");
    File list[] = file.listFiles();

Post a Comment for "Display Media Files In Listview, Nullpointerexception?"