Have a question.. I have a list of mp3 filenames to add a new file name use:
musicList.add(new Mp3(id, filename));
now I wanted to create a array containing this lists
private static final int LIST_COUNT = 8;
public static List<List<Mp3>> musicLists = new ArrayList<List<Mp3>>(LIST_COUNT);
private void parseMus(){
musicLists = new ArrayList<List<Mp3>>(LIST_COUNT);
...
//gettin mp3 list id,filename, length
...
musicLists.get(listNr).add(new Mp3(id,filename,length));
...
}
but it gives me errors:
03-15 21:01:36.030: E/AndroidRuntime(3393): java.lang.IndexOutOfBoundsException: Invalid index 4, size is 0
Second quwestion! now I edited code and have no errors... BUT now what i get is that all list is filled with same lists.. so when i try to see:
for(int i =0; i< Settings.musicLists.size();i++){
if(D)Log.e("visio added","MP3 file muslist nr="+i+"= "+Settings.musicLists.get(i));
}
I get 8 identical rows shown... what I do wrong?
for (i=0;i<LIST_COUN;i++) musicLists.add(foo)when i putmusicLists.get(listNr).add(new Mp3(id,filename,length));it should put it in the list in listNr ... or Im I understanding it wrong?