Android examples for User Interface:ActionBar
set Navigation Selected for ActionBar
//package com.java2s; import android.app.ActionBar; import android.app.Activity; import android.widget.ArrayAdapter; public class Main { public static boolean setNavigationSelected(Activity activity, ArrayAdapter<String> adapter, String selected) { ActionBar actionBar = activity.getActionBar(); if (actionBar != null) { int setPosition = adapter.getPosition(selected); actionBar.setSelectedNavigationItem(setPosition); return true; }//from w w w.ja v a 2s. c om return false; } }