06-28-2010 10:43 AM - edited 06-28-2010 11:21 AM
Ok guys Ive learned a lot of things from this thread. (I like to learn stuff)
Now my final question is. If ListFieldCallback does not get implemented,... what happens exactly?
EDIT: And also do I have to make a custom Manager. Like can I just create a Field on drawListRow, and then lay it out (hmmm somehow, Im not sure how)
06-28-2010 12:08 PM
A ListField is basically useless without a ListFieldCallback. From the API docs:
A ListField must register a class that implements the ListFieldCallback interface using the setCallback method before the class can be used.
If you don't have one, when a ListField needs to display a row, it either does nothing or throws an exception (I don't know which--never tried it.)
For drawListRow, you can use any kind of Field to organize the lay-out. It doesn't have to be a Manager, although that is usually what you'd want to use if the row layout is best done by arranging subordinate fields (labels, bitmaps, rich text, etc.). Of course, you don't need to use any kind of Field at all; you can keep your own data structures and do the layout computations yourself. The only reason to use a Field (more specifically, a Manager), is to take advantage of the functionality already there in the RIM APIs.
Your ListFieldCallback can be implemented anywhere: you can subclass ListField and implement it there (that's what ObjectListField does); you can implement it in the containing Manager/Screen (which might already have all the needed data); or it can be a stand-alone class (which might make it easier to plug in different "looks" for your list). The choice is a style issue, I think, and no method is best.
06-28-2010 02:00 PM
Thanks a lot man.
I am understanding more and more about this.
The only weird thing is that my code works without a ListFieldCallback.
Anyway now Im trying to implement ListFieldCallback, but for some reason drawListRow, doesnt get called. (I setCallback(this); in my constructor)