I am trying to access all the data from database "listOfFolder" table "folder" and want to store the data in a string array folders[] but i am getting how to resolve ArrayIndexOutOfBoundsException.
try{
  mydb = openOrCreateDatabase("listOfFolder", MODE_WORLD_WRITEABLE, null);  
    } catch (Exception e) {
        // TODO: handle exception
        e.printStackTrace();
      }
int count = 0;
String folders[] = null;
Cursor folderCursor = mydb.query("folder", null, null, null, null, null, null); 
while(folderCursor.moveToNext()) {
  folders[count] = folderCursor.getString(folderCursor.getColumnIndex("name"));
                    count++;
}
ListView list = (ListView)findViewById(R.id.lv);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(DropboxActivity.this, android.R.layout.simple_list_item_1,folders);
list.setAdapter(adapter);
setContentView(R.layout.listoffolder);
 
     
     
     
    