I have created a table in BlackBerry Java using TableView and TableModel.
Now, I want to set the width and height of particular cell. How can I do that?
I have created a table in BlackBerry Java using TableView and TableModel.
Now, I want to set the width and height of particular cell. How can I do that?
You have multiple options. It partly depends on what features your table needs to support, but also what OS version you are targeting (what minimum OS version your app needs to run on).
Here are a few choices (I'm sure there are more, too):
if you can accept supporting only devices with OS 6.0 or above, then you could use the TableModel
, and its associated classes from the RIM libraries. See this page for an example of that. This is a fairly well-architected approach to separating model from presentation. There are also other classes, RichList and SimpleList that were introduced in OS 6.0.
if you need to support older OS versions, you could use the ListField class, or the subclass called ObjectListField. ObjectListField
is especially easy to get setup to display a simple list (table). But, you may find it limiting, and need to resort to a third major option ...
you can always make your own list/table, by extending the Manager
class, or using VerticalFieldManager
. Each row in the vertical list would be a Field
that you can define however you like. Here's a recent stack overflow question I answered showing some code that basically does this. If you're coming from Android or iOS, you might find this to be a little more work than you'd like, but it will give you complete control, and can support any OS version.
This is a bit of an open-ended question, so you may need to provide some more specifics about how the table will look, or what kind of interactions each row will support - for example,
Then, we might be able to give more specific recommendations.
P.S. There used to be a great link that BlackBerry maintained (like what Google has for Android) concerning the market share of current devices. It died, and this is the best replacement I've found (update: link now also obsolete!). It looks like probably 80% of paid smartphone apps are downloaded by phones running OS 6.0 or above. It's hard to tell exactly, as that link is showing data as of May 31, 2012. But, that at least gives you an idea, if you don't know which minimum OS to target.