Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
    
    
  
  
    
    
    
    BaseAdapter
    abstract class BaseAdapter : ListAdapter, SpinnerAdapter
    
    
      
        
          | Known Direct Subclasses
              
              
                
                  
                    | ArrayAdapter | You can use this adapter to provide views for an AdapterView, Returns a view for each object in a collection of data objects you provide, and can be used with list-based user interface widgets such asListVieworSpinner. |  
                    | CursorAdapter | Adapter that exposes data from a Cursorto aListViewwidget. |  
                    | SimpleAdapter | An easy adapter to map static data to views defined in an XML file. |  | 
      
    
    
      
        
          | Known Indirect Subclasses
              
              
             | 
      
    
    Common base class of common implementation for an Adapter that can be used in both ListView (by implementing the specialized ListAdapter interface) and Spinner (by implementing the specialized SpinnerAdapter interface).
    Summary
    
    
    Public constructors
    
      BaseAdapter
      BaseAdapter()
     
    Public methods
    
      areAllItemsEnabled
      
      open fun areAllItemsEnabled(): Boolean
      
        
          
            | Return | 
          
            | Boolean | True if all items are enabled, false otherwise. | 
        
      
     
    
    
      getDropDownView
      
      open fun getDropDownView(
    position: Int, 
    convertView: View!, 
    parent: ViewGroup!
): View!
      
        
          
            | Parameters | 
          
            | position | Int: index of the item whose view we want. | 
          
            | convertView | View!: the old view to reuse, if possible. Note: You should check that this view is non-null and of an appropriate type before using. If it is not possible to convert this view to display the correct data, this method can create a new view. | 
          
            | parent | ViewGroup!: the parent that this view will eventually be attached to | 
        
      
      
     
    
      getItemViewType
      
      open fun getItemViewType(position: Int): Int
      
        
          
            | Parameters | 
          
            | position | Int: The position of the item within the adapter's data set whose view type we want. | 
        
      
      
        
          
            | Return | 
          
            | Int | An integer representing the type of View. Two views should share the same type if one can be converted to the other in getView. Note: Integers must be in the range 0 togetViewTypeCount- 1.IGNORE_ITEM_VIEW_TYPEcan also be returned. | 
        
      
     
    
      getViewTypeCount
      
      open fun getViewTypeCount(): Int
      
        
          
            | Return | 
          
            | Int | The number of types of Views that will be created by this adapter | 
        
      
     
    
      hasStableIds
      
      open fun hasStableIds(): Boolean
      
        
          
            | Return | 
          
            | Boolean | True if the same id always refers to the same object. | 
        
      
     
    
      isEmpty
      
      open fun isEmpty(): Boolean
      
        
          
            | Return | 
          
            | Boolean | true if this adapter doesn't contain any data. This is used to determine whether the empty view should be displayed. A typical implementation will return getCount() == 0 but since getCount() includes the headers and footers, specialized adapters might want a different behavior. | 
        
      
     
    
      isEnabled
      
      open fun isEnabled(position: Int): Boolean
      
        
          
            | Parameters | 
          
            | position | Int: Index of the item | 
        
      
      
        
          
            | Return | 
          
            | Boolean | True if the item is not a separator | 
        
      
     
    
      notifyDataSetChanged
      
      open fun notifyDataSetChanged(): Unit
      Notifies the attached observers that the underlying data has been changed and any View reflecting the data set should refresh itself.
     
    
      notifyDataSetInvalidated
      
      open fun notifyDataSetInvalidated(): Unit
      Notifies the attached observers that the underlying data is no longer valid or available. Once invoked this adapter is no longer valid and should not report further data set changes.
     
    
      registerDataSetObserver
      
      open fun registerDataSetObserver(observer: DataSetObserver!): Unit
      
        
          
            | Parameters | 
          
            | observer | DataSetObserver!: the object that gets notified when the data set changes. | 
        
      
     
    
    
  
  
  
    
  
 
  
    
      
      
    
    
      
    
    
  
       
    
    
      
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-02-10 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[]]