0

私はこのコードを呼び出しています getSupportFragmentManager() .beginTransaction() .replace(R.id.menu_frame_two, new SlideRight()) .commit();

引き起こす

10-14 07:12:57.895: E/AndroidRuntime(2293): java.lang.IllegalArgumentException: No view found for id 0x7f07010e (com.test:id/menu_frame_two) for fragment SlideRight{a7754e48 #0 id=0x7f07010e}.

何か助けはありますか?

4

2 に答える 2

0
// try this
    SlideRight fragment;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.yourxml);

        if (savedInstanceState == null) {
            // Add the fragment on initial activity setup
            fragment = new SlideRight();
            getSupportFragmentManager().beginTransaction().add(android.R.id.menu_frame_two, fragment).commit();
        } else {
            // Or set the fragment from restored state info
            fragment = (SlideRight) getSupportFragmentManager().findFragmentById(android.R.id.menu_frame_two);
        }
    }
于 2013-10-14T07:25:13.657 に答える