「import android.app.Fragment;」を使用している場合 次に、次のいずれかを使用します。
1)
ExampleFragment fragment = (ExampleFragment) getFragmentManager().findFragmentById(R.id.example_fragment);
fragment.specific_function_name();
R.id.example_fragment は、xml レイアウト内の FrameLayout id である可能性が最も高い場所です。また
2)
ExampleFragment fragment = (ExampleFragment) getFragmentManager().findFragmentByTag(“FragTagName”);
fragment.specific_function_name();
FragTagName は、実行時に指定した名前です。
TabHost mTabHost.newTabSpec(“FragTagName”)
「import android.support.v4.app.Fragment;」を使用している場合 次に、次のいずれかを使用します。
1)
ExampleFragment fragment = (ExampleFragment) getSupportFragmentManager().findFragmentById(R.id.example_fragment);
fragment.specific_function_name();
また
2)
ExampleFragment fragment = (ExampleFragment) getSupportFragmentManager().findFragmentByTag(“FragTagName”);
fragment.specific_function_name();