Android Activity Get provideNavigationAdapter( Activity activity, String[] items)

Here you can find the source of provideNavigationAdapter( Activity activity, String[] items)

Description

Prepares a correctly colored ArrayAdapter for a given theme

Parameter

Parameter Description
activity a parameter
items a parameter

Declaration

public static ArrayAdapter<String> provideNavigationAdapter(
        Activity activity, String[] items) 

Method Source Code

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

public class Main {
    /**/*from www .  j a  v a 2s  . c  o m*/
     * Prepares a correctly colored ArrayAdapter for a given theme
     *
     * @param activity
     * @param items
     */
    public static ArrayAdapter<String> provideNavigationAdapter(
            Activity activity, String[] items) {

        ActionBar actionBar = activity.getActionBar();

        if (actionBar != null) {

            return new ArrayAdapter<String>(
                    actionBar.getThemedContext() != null ? actionBar.getThemedContext()
                            : activity,
                    android.R.layout.simple_list_item_1, items);

        }

        return null;
    }
}

Related

  1. getThemeUpIndicator(Object info, Activity activity)
  2. getThemeUpIndicator(Object info, Activity activity)
  3. getActivityMetaData(Activity activity, String key)
  4. getFirstActivityName(Context context, String pkg)