Back to project page MyFlickrSearch.
The source code is released under:
MIT License
If you think the Android project MyFlickrSearch listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.devng.flickrsearch; /*w w w. j av a 2 s. c o m*/ import android.annotation.TargetApi; import android.os.Build; import android.os.Bundle; import android.view.MenuItem; import roboguice.activity.RoboActivity; /** * Activities which extend this class will have a back button on the left side of the menu bar. */ public abstract class AbstractBackButtonActivity extends RoboActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { setupActionBar(); } } @TargetApi(Build.VERSION_CODES.HONEYCOMB) private void setupActionBar() { getActionBar().setDisplayHomeAsUpEnabled(true); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: this.onBackPressed(); return true; } return super.onOptionsItemSelected(item); } }