Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.volar.app.volarcars.activity;
- import android.os.Bundle;
- import android.support.v7.app.ActionBarActivity;
- import android.view.Menu;
- import android.view.MenuItem;
- import com.volar.app.volarcars.R;
- public class CityActivity extends ActionBarActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_city);
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
- getSupportActionBar().setHomeButtonEnabled(true);
- getSupportActionBar().setDisplayShowTitleEnabled(false);
- getSupportActionBar().setDisplayShowCustomEnabled(true);
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.menu_city, menu);
- return true;
- }
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- if (item.getItemId() == android.R.id.home) {
- finish();
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
- @Override
- public void onBackPressed() {
- moveTaskToBack(true);
- CityActivity.this.finish();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement