2013년 2월 24일 일요일

listview adapter.remove unsupportedoperationexception

Check if you use string array, not arraylist. String array doesn't have remove() method, so when you try to use remove() method, it gives UnsupportedOperationException. So change string array to arraylist.



String[] array = {"a","b","c","d","e","f","g"}; 
ArrayList<String> lst = new ArrayList<String>();
lst.addAll(Arrays.asList(array));
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, 
android.R.layout.simple_list_item_1, lst); 

댓글 없음:

댓글 쓰기