Android adapter-baseadapter (help Documentation)

Source: Internet
Author: User

Structure

Inheritance relationship

Public abstract class baseadapter

Extends object implementslistadapter spinneradapter

Java. Lang. Object

Android. widget. baseadapter

Subclass and indirect subclass

Direct subclass

Arrayadapter <t>, cursoradapter, simpleadapter

Indirect subclass

Resourcecursoradapter, simplecursoradapter

Class Overview

It is used to implement a public base class adapter in combination with listview (implementing the specified listadapter Interface) and spinner (implementing the specified spinneradapter interface.

Common Methods

Public Abstract BooleanAreallitemsenabled()

Are all items available in listadapter? If yes, all projects are selectable and can be clicked with the mouse.

Return Value

Returns true if all items are available

Public abstractview
Getdropdownview(INT position, view convertview,

Viewgroup parent)

Obtain a view that displays data from the drop-down list at a specified position.

Parameters

Position: retrieve the index of the project view

Convertview if the old view may be used again. Note: before use, check that the view is not empty and the type is appropriate. It is impossible to display correct data in the conversion view. This method can create a new view.

The parent object to which the parent view is attached.

Return Value

A view of data at the specified position.

Public int
Getitemviewtype(INT position)

Obtains the type of view created for a specified project through getview.

Parameters

Position in the adapter data, we want to know the position of a view-type project.

Return Value

Description of an integer view type. If a view is converted to another view by using the getview (INT, view, viewgroup) method, the two views share the same type. Note: The integer must be 0 and getviewtypecount ()-
Between 1. Ignore_item_view_type can also be returned.

Public int
Getviewtypecount()

Returns the number of types of views created through getview (INT, view, viewgroup. Each type indicates a group of views converted using the getview (INT, view, viewgroup) method. If the adapter returns the same view type for all items, this method returns 1.

This method is called only when the adapter is set to adapterview.

Return Value

Number of view types created through this adapter

Public BooleanHasstableids()

Indicates whether the changes to the basic data are stable when the project ID is used.

Return Value

If the same ID indicates the same object, true is returned.

Public BooleanIsempty()

Whether the adapter data item is equal to zero

Public BooleanIsenabled(INT position)

If the specified location is not an isolated project (the isolated project is an unselectable project and cannot be clicked with the mouse), the system returns true. If the location is invalid, the result is uncertain. In this case, an arrayindexoutofboundsexception (out of bounds) exception will be thrown.

Parameters

Position item index

Return Value

Returns true if this project is not an isolated project.

Public void
Notifydatasetchanged()

The basic view data attached to the notification has changed, and the view should be refreshed automatically.

Public void
Notifydatasetinvalidated()

The observer of monitoring data is no longer valid

Public void
Registerdatasetobserver(Datasetobserver observer)

Register an observer for adapter (Observer: called when monitoring data changes)

Parameters

Object notified when data changes on the observer

Public void
Unregisterdatasetobserver(Datasetobserver observer)

Remove the observer that was previously registered using the registerdatasetobserver (datasetobserver) method (Observer: Class of metric data change)

Parameters

ObserverRemove registered objects

 

 

A bug in http://www.android123.com.cn/kaifafaq/604.html (baseadapter

The use of http://blog.csdn.net/Android_Tutor/article/details/5707835 (the omnipotent baseadapter in Android (spinner, listview, gridview!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.