karan singh
karan singh

Reputation: 27

set ArrayAdapter vs cursorAdapter for an AutoCompleteTextView

I have an autoCompleteTextView which i want to populate with values that are kept in a database. The number of values in the column might some day reach in thousands(according to the use).

I am unsure about the performance of the ACtextView incase I use method 1 (simpler method):

Method 1:

Define a method in the databaseHelper class which returns the values of entire column in the form of a string array. Pass the string array to the arrayAdapter. Then set this adapter to the ACtextView adapter.

Method 2:

Define a CursorAdapter class and use it to populate the results in the ACtextView. This is the link which describes this method.

AutoCompleteTextView with CursorAdapter

Upvotes: 0

Views: 600

Answers (1)

pskink
pskink

Reputation: 24730

if your data model is sqlite db never use ArrayAdapter, use one subclass of CursorAdapter (e. g. SimpleCursorAdapter) instead, use of ArrayAdapter is no simpler method

Upvotes: 1

Related Questions