Android Activity Set setNavigationSelected(Activity activity, ArrayAdapter adapter, String selected)

Here you can find the source of setNavigationSelected(Activity activity, ArrayAdapter adapter, String selected)

Description

set Navigation Selected

Declaration

public static boolean setNavigationSelected(Activity activity,
            ArrayAdapter<String> adapter, String selected) 

Method Source Code

//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 ww. j a  v a 2s .co m*/

        return false;
    }
}

Related

  1. setDisplayHomeAsUpEnabled(Activity a, boolean enabled)
  2. setNavigationList(Activity activity, SpinnerAdapter adapter, ActionBar.OnNavigationListener listener)
  3. setDisplayHomeAsUpEnabled(Activity activity, boolean b)
  4. setDisplayHomeAsUpEnabled(Activity activity, boolean b)
  5. onCreateSetTheme(Activity activity)