0

ビューページャーなどを使用せずに、単一のフラグメントで FragmentActivity を使用しようとしています。

getTag メソッドで Fragment からのタグ値が必要です...

FragmentActivity の onCreate の私のコード:

    // launch splash screen fragment
    Fragment fragment = SplashScreenFragment.newInstance();
    getSupportFragmentManager().beginTransaction().add(android.R.id.content,          fragment).commit();

また、SplashScreenFragment が onCreateView の場合、getTag() メソッドはフラグメントで null を返します。

私はこれを理解していません..私はXMLレイアウトでFragment属性を使用していません。それが理由ですか?

編集 ::

このコードを実行するにはタグが必要です:

    this.mSplashScreenFragment = (SplashScreenFragment) mMainFragmentActivity.getSupportFragmentManager().findFragmentByTag(tag);   

この行の後の mSplashScreenFragment は null ..

ご協力ありがとう御座います !

4

1 に答える 1