How to navigate from contentView to fragment

Refresh

6 days ago

Views

24 time

1

I would like to know how to move from a ContentView to fragment.

Example

I have:

1)FragmentA extends Fragment

2)FragmentB extends Fragment

3)setContentView (new SomeView(view.getContext)) on Fragment B

Now i would like to move from SomeView to FragmentA, How can i do it? Thank you

Moving from FragmentA to FragmentB,the code:

Fragment selectedFragment = null;
                selectedFragment = new FragmentB;
                getFragmentManager().beginTransaction().replace(R.id.frame_container,selectedFragment).commit();

setContentView on FragmentB, the code:

//this view was added later on a button pressed. Fragment B originally has a default view

getActivity().setContentView(new SomeView(view.getContext()));

0 answers