If you use "import android.app.Fragment;" Then use either:
one)
ExampleFragment fragment = (ExampleFragment) getFragmentManager().findFragmentById(R.id.example_fragment); fragment.specific_function_name();
Where R.id.example_fragment is most likely the FrameLayout identifier inside your xml layout. OR
2)
ExampleFragment fragment = (ExampleFragment) getFragmentManager().findFragmentByTag("FragTagName"); fragment.specific_function_name();
Where FragTagName is the name u specified with u:
TabHost mTabHost.newTabSpec("FragTagName")
If you use "import android.support.v4.app.Fragment;" Then use either:
one)
ExampleFragment fragment = (ExampleFragment) getSupportFragmentManager().findFragmentById(R.id.example_fragment); fragment.specific_function_name();
OR
2)
ExampleFragment fragment = (ExampleFragment) getSupportFragmentManager().findFragmentByTag("FragTagName"); fragment.specific_function_name();
Gene Aug 20 '14 at 23:51 2014-08-20 23:51
source share