Class DropDownAdapter

  • All Implemented Interfaces:
    android.widget.Adapter, android.widget.ListAdapter, android.widget.SpinnerAdapter

    public class DropDownAdapter
    extends java.lang.Object
    implements android.widget.ListAdapter, android.widget.SpinnerAdapter

    Wrapper class for an Adapter. Transforms the embedded Adapter instance into a ListAdapter.

    • Field Summary

      • Fields inherited from interface android.widget.Adapter

        IGNORE_ITEM_VIEW_TYPE, NO_SELECTION
    • Constructor Summary

      Constructors 
      Constructor Description
      DropDownAdapter​(android.widget.SpinnerAdapter adapter, android.content.res.Resources.Theme dropDownTheme)
      Creates a new ListAdapter wrapper for the specified adapter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean areAllItemsEnabled()
      If the wrapped SpinnerAdapter is also a ListAdapter, delegate this call.
      int getCount()  
      android.view.View getDropDownView​(int position, android.view.View convertView, android.view.ViewGroup parent)  
      java.lang.Object getItem​(int position)  
      long getItemId​(int position)  
      int getItemViewType​(int position)  
      android.view.View getView​(int position, android.view.View convertView, android.view.ViewGroup parent)  
      int getViewTypeCount()  
      boolean hasStableIds()  
      boolean isEmpty()  
      boolean isEnabled​(int position)
      If the wrapped SpinnerAdapter is also a ListAdapter, delegate this call.
      void registerDataSetObserver​(android.database.DataSetObserver observer)  
      void unregisterDataSetObserver​(android.database.DataSetObserver observer)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface android.widget.Adapter

        getAutofillOptions
    • Constructor Detail

      • DropDownAdapter

        public DropDownAdapter​(@Nullable
                               android.widget.SpinnerAdapter adapter,
                               @Nullable
                               android.content.res.Resources.Theme dropDownTheme)
        Creates a new ListAdapter wrapper for the specified adapter.
        Parameters:
        adapter - the SpinnerAdapter to transform into a ListAdapter
        dropDownTheme - the theme against which to inflate drop-down views, may be null to use default theme
    • Method Detail

      • getCount

        public int getCount()
        Specified by:
        getCount in interface android.widget.Adapter
      • getItem

        @Nullable
        public java.lang.Object getItem​(int position)
        Specified by:
        getItem in interface android.widget.Adapter
      • getItemId

        public long getItemId​(int position)
        Specified by:
        getItemId in interface android.widget.Adapter
      • getView

        @Nullable
        public android.view.View getView​(int position,
                                         @Nullable
                                         android.view.View convertView,
                                         @NonNull
                                         android.view.ViewGroup parent)
        Specified by:
        getView in interface android.widget.Adapter
      • getDropDownView

        @Nullable
        public android.view.View getDropDownView​(int position,
                                                 @Nullable
                                                 android.view.View convertView,
                                                 @NonNull
                                                 android.view.ViewGroup parent)
        Specified by:
        getDropDownView in interface android.widget.SpinnerAdapter
      • hasStableIds

        public boolean hasStableIds()
        Specified by:
        hasStableIds in interface android.widget.Adapter
      • registerDataSetObserver

        public void registerDataSetObserver​(@NonNull
                                            android.database.DataSetObserver observer)
        Specified by:
        registerDataSetObserver in interface android.widget.Adapter
      • unregisterDataSetObserver

        public void unregisterDataSetObserver​(@NonNull
                                              android.database.DataSetObserver observer)
        Specified by:
        unregisterDataSetObserver in interface android.widget.Adapter
      • areAllItemsEnabled

        public boolean areAllItemsEnabled()
        If the wrapped SpinnerAdapter is also a ListAdapter, delegate this call. Otherwise, return true.
        Specified by:
        areAllItemsEnabled in interface android.widget.ListAdapter
      • isEnabled

        public boolean isEnabled​(int position)
        If the wrapped SpinnerAdapter is also a ListAdapter, delegate this call. Otherwise, return true.
        Specified by:
        isEnabled in interface android.widget.ListAdapter
      • getItemViewType

        public int getItemViewType​(int position)
        Specified by:
        getItemViewType in interface android.widget.Adapter
      • getViewTypeCount

        public int getViewTypeCount()
        Specified by:
        getViewTypeCount in interface android.widget.Adapter
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface android.widget.Adapter