Android - setListAdapter() + notifyDataSetChanged() clarification -


i have listfragment data populated custom adapter ( simpleadapter in case). experiencing issues using notifydatasetchanged() within class extended listfragment. after lot of looking around , several (useful) stack overflow posts later:

listview not updating notifydatasetchanged() call

android listview not refreshing after notifydatasetchanged

adapters notifydatasetchanged not work

notifydatasetchanged not working

listview not update when calling notifydatasetchanged baseadapter

i understand loose (and highly un-recommended) workaround re-set adapter using setlistadapter(). facing issues well.

the documentation, http://developer.android.com/reference/android/app/listfragment.html#setlistadapter(android.widget.listadapter), mentions setlistadapter()

provides cursor list view.

but still have questions.

q1. initializing adapter multiple times using setlistadapter() 'point' same adapter instance ?

q2. happens when call made getlistadapter() , notifydatasetchanged() when adapter has been set multiple times using setlistadapter() ?

q3. question based on assumption q2- when notifydatasetchanged() called when adapter set multiple times, of adapter instances (this part assumption), if exist' being notified change ?

i beginner android , believe there quite few nuances not understand.i extremely grateful if clarify these questions. thank time.

q1. initializing adapter multiple times using setlistadapter() 'point' same adapter instance ?

ans: initializing adapter point last instance set using setlistadapter.

q2. happens when call made getlistadapter() ,  notifydatasetchanged() when adapter has been set multiple times using  setlistadapter() ? 

ans: doesn't matter how many adapters have initialized, last instance retrieved using getlistadapter().when use notifydatasetchanged() last instance wich retrieved using getlistadapter() refreshed i.e. ; last instance reloaded(by calling getview).

q3. question based on assumption q2- when notifydatasetchanged()  called when adapter set multiple times, of adapter instances (this  part assumption), if exist' being notified change ? 

ans: above answer contains explanation this.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -