I know we can move between activities via an intent call. But is there a way to move from one activity to a particular fragment hosted by an activity? For example if I have an activity A which hosts 2 fragments f1 and f2,is there a way to move from another activity say B to fragment f2 directly via intent call?
Thanks in advance.
I know we can move between activities via an intent call. But is there
Share
hmm it is not possible directly via intent call, you will have to start activity A and via an extra/bundle in intent you can specify to activity A to open fragment f2, meaning you will have to write the logic yourself… not possible directly .. Cheers
Try this in Activity B it will open ActivityA and its sending a string which you can check in that activity, based on that string you will add fragment:
and in ActivityA oncreate
check toOpen string and open appropriate fragment..
Are you asking how to show/add fragments as well , because thats a complete new ball game 🙂 but this would be a nice starts for managing fragments http://developer.android.com/guide/components/fragments.html