SHARE
TWEET

Untitled

a guest May 24th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package ordo.azurewebsites.net.ordo;
  2.  
  3. import android.support.v7.app.ActionBar;
  4. import android.support.v7.app.AppCompatActivity;
  5. import android.support.v7.widget.Toolbar;
  6. import android.view.MenuItem;
  7.  
  8. public class BaseScannerActivity extends AppCompatActivity {
  9.     public void setupToolbar() {
  10.         Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  11.         setSupportActionBar(toolbar);
  12.         final ActionBar ab = getSupportActionBar();
  13.         if(ab != null) {
  14.             ab.setDisplayHomeAsUpEnabled(true);
  15.         }
  16.     }
  17.  
  18.     @Override
  19.     public boolean onOptionsItemSelected(MenuItem item) {
  20.         switch (item.getItemId()) {
  21.             // Respond to the action bar's Up/Home button
  22.             case android.R.id.home:
  23.                 finish();
  24.                 return true;
  25.         }
  26.         return super.onOptionsItemSelected(item);
  27.     }
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top