My previous post about creating a custom field generated this comment. I could have just posted the source, but why waste an opportunity for another post?
The example at the end of that post:

Remember that? It was just kind of a fun way to show off what CustomButtonField could do. But it also ended up illustrating what GridFieldManager could do, and more importantly, the basics of getting a BlackBerry user interface up and running.
What this application does is pretty much what any BlackBerry application with a UI does. That is:
1. Define a main screen class (derived from Screen or a subclass, in this case MainScreen)
2. Define an application class (derived from UiApplication)
3. Create a main method (public static void main(String[]))
4. In the main method, instantiate the application from 2.
5. Instantiate the main screen from 1.
6. Push the main screen onto the display (UiApplication.pushScreen)
7. Enter the event dispatcher (UiApplication.enterEventDispatcher())
Basically when you click on an icon on the BlackBerry homescreen, your main method is called (optionally with some arguments that can be defined at compile time, or when invoking an app from another app). The thread that calls the main method will become the event thread of your application when you call enterEventDispatcher. All of this is explained in more detail in my post on BlackBerry UI Threading
The code for the screen class and application class follows:
CustomButtonDemoScreen.java
CustomButtonDemoApplication.java
Of course, you’ll also need to get:






8 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.
wow thanks!! i didn’t think you’d do it on the same day. Man this site is excellent, i really appreciate the work you put into all this! Kudos to you! =)
Wow this site is just what the BB community needs! Keep up the great work man im sure this blog will grow big time!
Hi Anthony,
Can you elaborate (perhaps in a separate post) on how focus movement is handled in the GridFieldManager and how focus movement is handled in general? I am having a peculiar issue, where I have a RadioButtonField inside a cell of the GridFieldManager. The RadioButtonField has only two options, yes and no. But when I try to move the focus between yes and no, the focus leaves the cell. I am not able to change the radio button option. A writeup on navigationFocus, moveFocus, nextFocus etc., will greatly help me and many others in understanding focus related issues and challenges. Thanks.
Anthony,
First, I must compliment you on your site - I have read several archives and tested the code found within, with the result of having learned a lot about the BlackBerry programming environment.
For your archvie 194, CustomButtonField and GridFieldManager together at last, links appear for four files. Three of the links work, and the CustomButtonField.java link cannot find the file to download.
Hopefully, this missing link will be fixed soon - looking foward to working with this archive example.
Regards,
RichardMurphy
It looks like you may have a borken link on your CustomButtonField.java file.
Absolutely wonderful. As a noob to BB and Java, this is great. Thanks for such easy to follow code.
CustomButtonField.java, which is what I need, does not exist!
Custombuttonfield.java classs is missing please provide it
i need it urgent