Code example for FragmentActivity

Methods: getApplication, getResources, getTitle, onCreate, setContentView

0
    public void invalidateOptionsMenuCompatible() { 
        ActivityMixin.invalidateOptionsMenu(this);
    } 
 
    protected void onCreate(final Bundle savedInstanceState, final int resourceLayoutID) {
        super.onCreate(savedInstanceState);
 
        initializeCommonFields(); 
 
        // non declarative part of layout 
        setTheme(); 
        setContentView(resourceLayoutID);
 
        // create view variables 
        Views.inject(this);
    } 
 
    private void initializeCommonFields() { 
        // initialize commonly used members 
        res = this.getResources();
        app = (CgeoApplication) this.getApplication();
 
        // only needed in some activities, but implemented in super class nonetheless 
        Cookies.restoreCookieStore(Settings.getCookieStore()); 
        ActivityMixin.keepScreenOn(this, keepScreenOn);
    } 
 
    @Override 
    public void setContentView(int layoutResID) {
        super.setContentView(layoutResID);
 
        // initialize the action bar title with the activity title for single source 
        ActivityMixin.setTitle(this, getTitle());
    } 
 
    protected void hideKeyboard() { 
        ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0);
    }