Possible to create widgets dynamically?

For each Contact, I want to create three checkboxes and a TextView inside an Activity. Is this possible? If so, how? Another stackoverflow answers says No, it's not possible, but I find that hard to believe...

Upvotes: 0

Views: 249

Answers (1)

Brian Dupuis
Brian Dupuis

Reputation: 8176

I don't know why it wouldn't be possible. Since it's "for each contact" I'd imagine you'd want a Cursor from the ContactsContract content provider. As such, you will also likely want a ListView if your goal is to display a list of contacts. Given you have a cursor that has the information for your contact, you'd then utilize a CursorAdapter of some kind to map those contacts in the cursor into ListView items. Then you'd design your ListView item layouts with 3 CheckBox widgets and a TextView and populate them appropriately. Doesn't seem impossible.

Upvotes: 1

Related Questions