Answers for "android fragment call activity method"

0

calling activity method from fragment:

((YourActivityClassName)getActivity()).yourPublicMethod();
Posted by: Guest on July-31-2021
0

fragment call activity

Intent myIntent = new Intent((ParentActivity)getActivity(), YourOtherActivity.class);
(ParentActivity)getActivity().startActivity(myIntent);
Posted by: Guest on January-11-2022
-1

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 "android fragment call activity method"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language