Answers for "start fragment method from activity"

1

start fragment from activity

FragmentManager manager = getFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.add(R.id.container,YOUR_FRAGMENT_NAME,YOUR_FRAGMENT_STRING_TAG);
transaction.addToBackStack(null);
transaction.commit();
Posted by: Guest on November-06-2020
0

calling fragment method from activity

ExampleFragment fragment = (ExampleFragment) getFragmentManager().findFragmentById(R.id.example_fragment); 
fragment.specific_function_name();
Posted by: Guest on June-03-2021

Code answers related to "start fragment method from activity"

Browse Popular Code Answers by Language