android - why isn't my activity class's instance variable value being preserved onResume()? -


  1. i have listview in activity b populated list of lists through adapter. list of lists retrieved bundle passed activity so:

    @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_results); lvlineups = (listview)findviewbyid(r.id.lvresults);  }  @override protected void onresume() { super.onresume(); lineups = (arraylist<arraylist<band>>) getintent().getserializableextra("results"); resultsadapter resultsadapter = new resultsadapter(this, lineups); lvlineups.setadapter(resultsadapter); } 
  2. i launch implicit video intent activity activity b goes in background(paused, onpause invoked) , video goes in front.

  3. i click on video, killing activity.

  4. activity b's resumes(onresume called) , see list of lists(lineups) empty. according activity lifecyle, activity resuming why don't still see list of lists in step 1, , how preserve after implicit video intent.

note: looks vertical listview each row horizontally scrolling list. i've gotten layout work except when adding video intent. playing video , scrolling down causes indexoutofbounds exception because lineups, bundle received activity a, gone.

@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_results);      lvlineups = (listview)findviewbyid(r.id.lvresults);     lineups = (arraylist<arraylist<band>>) getintent().getserializableextra("results");     resultsadapter resultsadapter = new resultsadapter(this, lineups);     lvlineups.setadapter(resultsadapter); } 

after media player plays video , closes, returning activity b, see in debugger lineups empty. strange because uninitialized instance variable before oncreate called. expected remain same after video intent launched activity b, or @ least null.

ok, let go through activity cycle.

initially started activity b activity => lineups fetched bundle of activity a. value.

then launched video intent. going back. @ point onresume() gets called again (where bundle has no value lineups). should lineups in oncreate() rather onresume() gets called after pause.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -