Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Trusted Contributor
Posts: 182
Registered: ‎09-22-2011
My Device: 9700
My Carrier: airtel

Event Handling in PictureScrollField

I have a custom PictureScrollField and i want to do event handling.Here is my block of code


CustomPictureScrollField cbf = new CustomPictureScrollField(7, bitmap,
name, 105, 80, Display.getWidth(), 110, Color.BLUE) {
protected boolean navigationClick(int status, int time) {
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
CustomDialog cmd = new CustomDialog(Utils.D_YES_NO,
getCurrentImageIndex()+"", Color.PURPLE, 190);

return true;


The problem is that if i use getCurrentImageIndex() i get NoClassDefFound.Can anyone help me out?


Posts: 29
Registered: ‎12-16-2011
My Device: Bold 9900
My Carrier: Meteor - Ireland

Re: Event Handling in PictureScrollField

The problem is that you are creating a new instance of Runnable() and calling get currentCurrentImageIndex in that instance. It is not in the same instance as where you created the custom picture scroll field.

You need to extend Runnable() and create a property with the type "CustomPictureScrollField ". You need a constructor that takes that property in.

P.S. You should use the code function when posting code. the above is very hard to read.

My Blackberry Blog - Coming Soon
ConorHackett.com - My Personal Site