java - Data in the gridview does not change upon update in realtime -
i facing problem regards grid view update.. grid view contain words found user.. records shown when exit app.. when open app, contains updated list view... should here... looking possibility of using notifydatasetchanged()
, don't know how , put it... knows this?
here code of showing data in gridview..
//sliding menu onchange @override public void oncontentchanged() { super.oncontentchanged(); mopenbutton = (button) findviewbyid( r.id.button_open ); mdrawer = (multidirectionslidingdrawer) findviewbyid( r.id.drawer); gridview gridview = (gridview) findviewbyid(r.id.gridview1); wordguessedhandler guessed = new wordguessedhandler(this); list <wordguessed> guessedlist = guessed.getallwordguessed(); list<string> wordslist = new arraylist<string>(); for(wordguessed wg:guessedlist){ wordslist.add(wg.getword()); } arrayadapter<string> adapter = new arrayadapter<string>(this, android.r.layout.simple_list_item_1, wordslist); gridview.setadapter(adapter); }
first tell adapter notify data has changed , set adapter again.
adapter.notifydatachanged(); grid.setadapter(adapter);
Comments
Post a Comment