Gainster
Gainster

Reputation: 5631

Confused when to use Adapters and which one?

I have read a little bit about ListAdapter - ArrayAdapter - BaseAdapter - CursorAdapter. I don’t understand there usage in true sense.

I have scenario, in which I am showing word in a TextView and then there are 4 radio button options and user will select one.

I am confused if I can use any adapter functionality. Like when the word on the top is move to next word. Meaning selection shown as radio button options updates automatically because of binding.

In a nut shell i am looking for something like auto binding in .NET.

Upvotes: 0

Views: 304

Answers (2)

wired00
wired00

Reputation: 14438

ArrayAdapter can be used to link say a list of items with an array. The ArrayAdapter works between an your array data and a list item layout to populate a list.

a CursorAdapter can work in a similar way but can link a database query result set (in a cursor) to a list by populating list items.

They are both subclasses of ListAdapter

If data changes in either the database tables or Array both the Array and Cursor Adapters can be refreshed via notifyDataSetChanged()

Upvotes: 0

anticafe
anticafe

Reputation: 6892

BaseAdapter is the most basic Adapter of ListView. All remaining adapters extend from BaseAdapter.

If you are confused which adapter is suitable for you scenario, let choose BaseAdapter first.

Upvotes: 1

Related Questions