Android Guides | Samples

Android.Widget.ArrayAdapter Class

A concrete BaseAdapter that is backed by an array of arbitrary objects.

See Also: ArrayAdapter

Syntax

[Android.Runtime.Register("android/widget/ArrayAdapter", DoNotGenerateAcw=true)]
public class ArrayAdapter : BaseAdapter, IFilterable, IDisposable

Remarks

A concrete BaseAdapter that is backed by an array of arbitrary objects. By default this class expects that the provided resource id references a single TextView. If you want to use a more complex layout, use the constructors that also takes a field id. That field id should reference a TextView in the larger layout resource.

However the TextView is referenced, it will be filled with the toString() of each object in the array. You can add lists or arrays of custom objects. Override the toString() method of your objects to determine what text will be displayed for the item in the list.

To use something other than TextViews for the array display, for instance, ImageViews, or to have some of data besides toString() results fill the views, override ArrayAdapter`1.getView(int, android.view.View, android.view.ViewGroup) to return the type of view you want.

[Android Documentation]

Requirements

Namespace: Android.Widget
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Widget.ArrayAdapter are listed below.

See Also: BaseAdapter

Public Constructors

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Properties

[read-only]
ContextContext. Returns the context associated with this array adapter.
[read-only]
override
CountInt32. How many items are in the data set represented by this Adapter.
[read-only]
FilterFilter.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

Add(Object)
AddAll(params Object[])
AddAll(ICollection)
Clear()
Remove all elements from the list.
static
CreateFromResource(Context, Int32, Int32) : ArrayAdapter
Creates a new ArrayAdapter from external resources.
override
GetItem(Int32) : Object
Get the data item associated with the specified position in the data set.
override
GetItemId(Int32) : Int64
Get the row id associated with the specified position in the list.
GetPosition(Object) : Int32
override
GetView(Int32, View, ViewGroup) : View
Get a View that displays the data at the specified position in the data set.
Insert(Object, Int32)
Remove(Object)
SetDropDownViewResource(Int32)
SetNotifyOnChange(Boolean)
Control whether methods that change the list (ArrayAdapter`1.add(T), ArrayAdapter`1.insert(T, int), ArrayAdapter`1.remove(T), ArrayAdapter`1.clear()) automatically call ArrayAdapter`1.notifyDataSetChanged().
Sort(IComparator)