Code example for FragmentActivity

Methods: getActionBar, getSupportFragmentManager, onCreate

0
 
public class TestListActivity extends FragmentActivity { 
 
    @Override 
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
 
        getActionBar().setDisplayHomeAsUpEnabled(true); 
        getActionBar().setHomeButtonEnabled(true); 
 
        if (savedInstanceState == null) {
            TestListFragment fragment = TestListFragment.newInstance();
            FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
            ft.replace(android.R.id.content, fragment);
            ft.commit();
        } 
    } 
 
    @Override 
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {