Open microstudent opened 6 years ago
when binding on Activity/Fragment onCreate() , Rxlifecycle would add an bindingFragment, look like this:
protected void onCreate(Bundle savedInstanceState) { Log.d(TAG, "" + "ActionBarActivity onCreate"); super.onCreate(savedInstanceState); setContentView(R.layout.activity_jnitest); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment(), "myfragment") .commit(); } Log.d(TAG, "Fragment:"+getSupportFragmentManager().findFragmentById(R.id.container));
findFragmentById will return null. if we bind lifeCycle during onCreate() more than once, which is very common to do such as load a lot of data, it would attach more than one BindingFragment ! and it seems to be wrong.
when binding on Activity/Fragment onCreate() , Rxlifecycle would add an bindingFragment, look like this:
findFragmentById will return null. if we bind lifeCycle during onCreate() more than once, which is very common to do such as load a lot of data, it would attach more than one BindingFragment ! and it seems to be wrong.