how can i change activity to other activity with specific fragment in android? -


i have 2 activities , 1 navigation drawer in second activity.in first activity have container replace fragment when click drawer item changing fragment in container.now want doing in second activity: when click on items in second activity change activity first activity , show me specific fragment(for example favorite fragment) in fragment container.i can change second activity first activity intent can't replace fragment when intent. 1 case of items:

case 2: intent intent2 = new intent(lietneractivity.this, mainactivity.class); startactivity(intent2); fragment = new favoritefragment(); break; 

you can put bundle in intent, contains tag of fragment want show. , when first activity oncreate(), tag , make fragmentmanager create or show fragment.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -