List of usage examples for android.app ActionBar setDisplayHomeAsUpEnabled
public abstract void setDisplayHomeAsUpEnabled(boolean showHomeAsUp);
From source file:net.noviden.android.shoutout.NewPostScreen.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_post_screen); mNewPost = (EditText) findViewById(R.id.send_text_field); ActionBar mNewPostActionBar = getActionBar(); mNewPostActionBar.setDisplayHomeAsUpEnabled(true); mNewPostActionBar.setHomeButtonEnabled(true); }
From source file:com.keithandthegirl.ui.activity.EpisodesActivity.java
@TargetApi(11) private void setupActionBar() { Log.v(TAG, "setupActionBar : enter"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); }/*from w w w .jav a 2 s .c o m*/ Log.v(TAG, "setupActionBar : exit"); }
From source file:org.cnx.android.quizcards.activities.DeckListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.deck_list);/*from w w w.j a v a 2 s . c o m*/ // Allow going back with ActionBar ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); // Get UI elements deckListView = (ListView) findViewById(R.id.deckListView); // Retrieve decks from the database, show in list getDecks(); deckListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long resource_id) { // Get the id of the selected deck titlesCursor.moveToPosition(position); String id = titlesCursor.getString(titlesCursor.getColumnIndex(BaseColumns._ID)); // Launch the deck Intent cardIntent = new Intent(getApplicationContext(), DeckDetailsActivity.class); cardIntent.putExtra(DECK_ID, id); startActivityForResult(cardIntent, DECK_INFO_REQUEST); } }); }
From source file:com.btmura.android.reddit.app.AccountListActivity.java
private void setupViews(Bundle savedInstanceState) { ActionBar bar = getActionBar(); if (bar != null) { bar.setDisplayHomeAsUpEnabled(true); } else {//from ww w . j a va 2 s . com ViewStub vs = (ViewStub) findViewById(R.id.button_bar_stub); View buttonBar = vs.inflate(); addAccount = (Button) buttonBar.findViewById(R.id.ok); addAccount.setText(R.string.add_account); addAccount.setOnClickListener(this); View cancel = findViewById(R.id.cancel); cancel.setOnClickListener(this); } if (savedInstanceState == null) { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.account_list_container, AccountListFragment.newInstance()); ft.commit(); } }
From source file:com.klinker.android.twitter.settings.SettingsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(R.anim.slide_in_left, R.anim.activity_zoom_exit); AppSettings.invalidate();//from w ww . j ava2 s . c om Utils.setUpTheme(this, AppSettings.getInstance(this)); ActionBar ab = getActionBar(); ab.setDisplayHomeAsUpEnabled(true); ab.setDisplayShowHomeEnabled(true); getFragmentManager().beginTransaction().replace(android.R.id.content, new MainPrefFrag()).commit(); }
From source file:de.questmaster.fatremote.RemoteActivity.java
/** * Called when the activity is first created. * //from w w w . j a v a2s . com * @see android.app.Activity#onCreate(android.os.Bundle) */ @TargetApi(14) @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setContentView(R.layout.remote_activity); // used in Honeycomb and up if (Build.VERSION.SDK_INT >= ANDROID_V11) { ActionBar ac = this.getActionBar(); if (ac != null) { ac.setDisplayHomeAsUpEnabled(true); if (Build.VERSION.SDK_INT >= ANDROID_V14) { ac.setHomeButtonEnabled(true); } } } if (savedInstanceState == null) { // During initial setup, plug in the details fragment. RemoteFragment details = new RemoteFragment(); details.setArguments(getIntent().getExtras()); getSupportFragmentManager().beginTransaction().add(android.R.id.content, details).commit(); } mSettings.readSettings(this); }
From source file:de.schramke.android.navdrawer.sample.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.addLogHandler(new DefaultAndroidLogHandler()); Log.setContext(this); setContentView(R.layout.activity_main); // enable ActionBar app icon to behave as action to toggle nav drawer final ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); }/*from ww w . j av a 2 s . c o m*/ }
From source file:com.Candy.ota.settings.About.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.about);//from w w w . j ava2s. c om mHomeURL = (TextView) findViewById(ID_HOME_URL); mContact = (TextView) findViewById(ID_CONTACT); mLicense = (TextView) findViewById(ID_LICENSE); mHomeURL.setMovementMethod(LinkMovementMethod.getInstance()); mContact.setMovementMethod(LinkMovementMethod.getInstance()); mLicense.setMovementMethod(LinkMovementMethod.getInstance()); final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setDisplayHomeAsUpEnabled(true); }
From source file:org.spinsuite.view.LV_Menu.java
public void onCreate(Bundle icicle) { super.onCreate(icicle); super.setContentView(R.layout.v_menu); Bundle bundle = getIntent().getExtras(); if (bundle != null) { param = (ActivityParameter) bundle.getParcelable("Param"); }//from w ww . j a v a2s .c om if (param == null) param = new ActivityParameter(); // m_ActivityNo = param.getSFA_Menu_ID(); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); // new Menu lookupMenu = new LookupMenu(getApplicationContext(), LookupMenu.MAIN_MENU, conn); // menu = (ListView) findViewById(R.id.lv_Menu); // Load Data load(); // Action Menu Loader loadActionMenu = new LoadActionMenu(this, false); // menu.setOnItemClickListener(new ListView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapter, View arg1, int position, long arg3) { DisplayMenuItem item = (DisplayMenuItem) adapter.getItemAtPosition(position); param.setParent_ID(item.getSFA_Menu_ID()); param.setActivityMenu_ID(item.getActivityMenu_ID()); // Load from Action currentOptionBundle = loadActionMenu.loadAction(item, param); currentMenuItem = item; } }); }
From source file:com.android.mail.ui.LicensesActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.licenses_activity); // Enable back navigation final ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); }// w ww. j av a 2s. c o m InputStream input = null; String licenseHTML = null; try { // read the raw license String from the license HTML file input = getResources().openRawResource(R.raw.licenses); final String license = IOUtils.toString(input, "UTF-8"); // encode the license string for display as HTML in the webview licenseHTML = URLEncoder.encode(license, "UTF-8").replace("+", "%20"); } catch (IOException e) { LogUtils.e(LogTag.getLogTag(), e, "Error reading licence file"); } finally { if (input != null) { try { input.close(); } catch (IOException ioe) { // best attempt only } } } // set the license HTML into the webview final WebView webview = (WebView) findViewById(R.id.webview); webview.loadData(licenseHTML, "text/html", null); }