0

I need to create a GridView full of Buttons, each labelled with text from a query.

Which Adapter should I use? A ResourceCursorAdapter, a SimpleCursorAdapater or something else?

(SimpleCursorAdpater seems like it would do the job, except I can't work out how to tell it to put the colum values as an attribute of the button, rather than the content.)

fadedbee
  • 42,671
  • 44
  • 178
  • 308

1 Answers1

2

If the you're looking to handle the actual click event of the button (and not the actual parent grid item), I would just extend CursorAdapter and write your own custom CursorAdapter. Inflate your own layout containing the button, set the text, and set the click event.

SBerg413
  • 14,515
  • 6
  • 62
  • 88
  • resourcecursoradapter takes care of the inflating for you, also – njzk2 Oct 02 '13 at 13:13
  • sure - resourceCursorAdapter actually implements the newView() method, which is abstract in it's parent CursorAdapter. I just always tend to use CursorAdapter and implement newView myself. – SBerg413 Oct 02 '13 at 13:19
  • depends - might be only 1 or 2 lines. really not a big deal and the method is there if more needs to be added to it. – SBerg413 Oct 02 '13 at 13:54