Android Fragment initialization to various Custom Fragments, but only One at a time -
i trying initialize generic fragment in such manner can used globally no matter instance of is. example: public mainactivity extends activity{ private fragment fragment; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_first_layout); fragmentmanager fragmanager = getfragmentmanager(); fragmenttransaction transaction = fragmanager.begintransaction(); if(condition1){ fragment = new myfirstfragment(); transaction .add(r.id.registrationfragment, fragment); //registrationfragment framelayout transaction.commit(); }else if(condition2){ fragment = new mysecondfragment(); transaction .add(r.id.registrationfragment, fragment); //registrationfragment framelayout transaction.commit(); } //create intent filter //create mybroadca...