Studyon Minte9.com
Android




Up Button



You should offer the user a way to navigate to the logical parent screen.
Beginning in Android 4.1 (API level 16), you can declare the logical parent of each activity.
It will be ignored in older versions.

	%--- MyFirstAppManifest.xml
	
	... 
	
	<uses-sdk
		android:minSdkVersion="7"
		android:targetSdkVersion="18" />
	
	...

	<activity
            android:name="com.example.myfirstapp.DisplayMessageActivity"
            android:label="@string/title_activity_display_message" 
            
            android:parentActivityName="com.example.myfirstapp.MainActivity" >
	        <!-- Parent activity meta-data to support 4.0 and lower -->
	        <meta-data
	            android:name="android.support.PARENT_ACTIVITY"
	            android:value="com.example.myfirstapp.MainActivity" />
        </activity>


	%--- DisplayMessageActivity.java (only for minSdkVersion="14")

	public class DisplayMessageActivity extends Activity {

		@Override
		protected void onCreate(Bundle savedInstanceState) {
			...		
			ActionBar actionBar = getActionBar();
			actionBar.setHomeButtonEnabled(true);
			actionBar.setDisplayHomeAsUpEnabled(true);

		}
	}


http://developer.android.com/training/implementing-navigation/ancestral.html