Code example for FragmentActivity

Methods: fail, getSupportFragmentManager, setContentView

0
            layout.setOrientation(LinearLayout.VERTICAL);
            layout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
                    LinearLayout.LayoutParams.FILL_PARENT));
            layout.setId(FRAGMENT_ID);
 
            getSupportFragmentManager().beginTransaction() 
                    .add(FRAGMENT_ID, fragment)
                    .commit(); 
 
            fragmentId = FRAGMENT_ID;
 
            setContentView(layout);
        } 
 
        void setContentToLayout(int i, int fragmentId) {
            this.fragmentId = fragmentId;
            setContentView(i);
        } 
 
        T createFragment() { 
            try { 
                return fragmentClass.newInstance();
            } catch (IllegalAccessException e) {
                fail("could not create fragment"); 
            } catch (InstantiationException e) {
                fail("could not create fragment"); 
            } 
            return null; 
        } 
 
        T getFragment() {