Use ActionBar to enable the return button:
Add the following code in onCreate of Activity
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
A return arrow is displayed on the left. clicking the icon triggers the click event: <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + PC9wPgo8cHJlIGNsYXNzPQ = "brush: java;"> @ Override public boolean onOptionsItemSelected (MenuItem item) {switch (item. getItemId () {case android. r. id. home: NavUtils. navigateUpFromSameTask (this); break;} return super. onOptionsItemSelected (item );}
Next, modify the androidManifest. xml file:
The parentActivityName here is said to be valid only for Versions later than 4.0. in earlier versions, the IllegalArgumentException exception will occur:
You need to add a meta-data configuration in it for compatibility:
This is probably the case. The test returns the parent Activity successfully.