Java tutorial
/* Copyright (c) 2013 Richard G. Todd. * Licensed under the terms of the GNU General Public License (GPL) Version 3.0. */ package com.richtodd.android.quiltdesign.app; import java.util.EnumSet; import android.app.Activity; import android.os.Bundle; import android.support.v4.app.NavUtils; import android.view.MenuItem; public class MainPreferenceActivity extends Activity { // // Overrides // @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getActionBar().setDisplayHomeAsUpEnabled(true); getFragmentManager().beginTransaction().replace(android.R.id.content, CommonPreferenceFragment.create(EnumSet.allOf(PreferenceSections.class))).commit(); } @Override public boolean onOptionsItemSelected(MenuItem item) { int itemId = item.getItemId(); switch (itemId) { case android.R.id.home: { NavUtils.navigateUpFromSameTask(this); return true; } } return super.onOptionsItemSelected(item); } }