android fragment in fragment code example

Example 1: change fragment in android studio

// put the following code in onClickListner
// public void onClickListner(View view){
Navigation.findNavController(view).navigate(R.id.action_fromFragment_toFragment);
// action_fromFragment_toFragment is the id of transformatino, look in fragment map.
// }

Example 2: fragment manager in android

Intent intent = new Intent(v.getContext(), Addbill.class);
        v.getContext().startActivity(intent);
        getActivity().finish();

Tags:

Java Example