Back to project page whoisit-android.
The source code is released under:
MIT License
If you think the Android project whoisit-android 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.mitchbarry.android.whoisit.ui; /*w ww. jav a 2 s. c om*/ import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.MenuItem; import com.mitchbarry.android.whoisit.Injector; import butterknife.Views; /** * Base activity for a Bootstrap activity which does not use fragments. */ public abstract class BootstrapActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Injector.inject(this); } @Override public void setContentView(int layoutResId) { super.setContentView(layoutResId); // Used to inject views with the Butterknife library Views.inject(this); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This is the home button in the top left corner of the screen. // Dont call finish! Because activity could have been started by an outside activity and the home button would not operated as expected! Intent homeIntent = new Intent(this, CarouselActivity.class); homeIntent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP); startActivity(homeIntent); return true; default: return super.onOptionsItemSelected(item); } } }