SupportLeanbackDemo: dont override fragment's object from activity
Activity should only initialize fragment's object when it is first created. Then the object's lifecycle is controled by fragment. b/17547817 Change-Id: I169111d2936aadfa9386b288e6922c563b4b5277
This commit is contained in:
@@ -27,8 +27,12 @@ public class DetailsActivity extends Activity
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.details);
|
||||
((DetailsFragment)getFragmentManager().findFragmentById(R.id.details_fragment))
|
||||
.setItem((PhotoItem) getIntent().getParcelableExtra(EXTRA_ITEM));
|
||||
if (savedInstanceState == null) {
|
||||
// Only pass object to fragment when activity is first time created,
|
||||
// later object is modified and persisted with fragment state.
|
||||
((DetailsFragment)getFragmentManager().findFragmentById(R.id.details_fragment))
|
||||
.setItem((PhotoItem) getIntent().getParcelableExtra(EXTRA_ITEM));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user