android - ArrayAdapter goes beyond bounds -


i have arrayadapter arraylist filled. each time click on of item re-fill arraylist , send notifyondatasetchange() adapter. unknown me reason goes out of arraylist bounds in it's getview() method populates items. don't understand why happens. can guys explain theory of getview() invokation understand why going on. in advance!

here is:

class madapter extends arrayadapter<string> { public madapter(context context, int textviewresourceid, list<string> objects) { super(context, textviewresourceid, objects); } @override public view getview(int position, view convertview, viewgroup parent) { view v = convertview; if (v == null) { layoutinflater vi = (layoutinflater) getactivity().getsystemservice(context.layout_inflater_service); v = vi.inflate(r.layout.file_explorer_row, null); } else { } string txt = itemslist.get(position); // out of bounds happens here if (!txt.equals("")) { textview tt = (textview) v.findviewbyid(r.id.file_explorer_tv_filename); tt.settext(txt); } return v; } 

itemslist declared in outer class.

though not getting clear view of asking..i assuming , refilling entire arrayadapter again....

so try this.........

use removeview() on listview before setting adapter it...

eg:

listview.removeview(); listview.setadapter(youradapter); 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -