Thursday, April 29, 2010

[android-developers] IllegalStateException

hello

i have a custom view with BaseAdapter which list all my mp3 files in
SD card
it works great but the getCount have a problem if i want return the
size of my song list
indeed , i have a illegalStateException : "content of the adapter has
changed but ListView did not receive a notification....." It works
great if i choose another int number but i must have the size of my
song list

how can i fix this ?
thank you a lot for your help

public int getCount() {

//notifyDataSetChanged();
//getListView().setVisibility(getListView().GONE);
positionCourante=songs.size();
Log.v(TAG, "count " + count);
//getListView().setVisibility(getListView().VISIBLE);
return updateSongList();

}
public int updateSongList(){


File home=new File(MEDIA_PATH);
int positionCourante = 0;

if(home.listFiles(new test()).length >0){

for (File file:home.listFiles(new test())){
songs.add(file.getName());

Log.v(TAG, "liste " + songs.get(songs.size()-1));

}


positionCourante=songs.size();

getListView();

}

return positionCourante;
}

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment