set Navigation List for ActionBar - Android User Interface

Android examples for User Interface:ActionBar

Description

set Navigation List for ActionBar

Demo Code


//package com.java2s;
import android.app.ActionBar;
import android.app.Activity;

import android.widget.SpinnerAdapter;

public class Main {
    public static boolean setNavigationList(Activity activity,
            SpinnerAdapter adapter, ActionBar.OnNavigationListener listener) {

        ActionBar actionBar = activity.getActionBar();

        if (actionBar != null) {

            actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

            actionBar.setListNavigationCallbacks(adapter, listener);

            return true;

        }// w ww . j  av a 2  s.  c om

        return false;

    }
}

Related Tutorials