Code example for FragmentManager

Methods: beginTransaction, findFragmentById

0
        UIHelp.setupActionBar(this);
 
        FragmentManager fm = getSupportFragmentManager();
 
        // Create the list fragment and add it as our sole content. 
        if (fm.findFragmentById(android.R.id.content) == null) {
            AgenciesFragment list = new AgenciesFragment();
            fm.beginTransaction().add(android.R.id.content, list).commit();
        } 
    } 
 
    @Override 
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == android.R.id.home) {
            NavHelp.goHome(this);
            return true; 
        } 
        return false; 
    } 
}