Welcome!

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

Reply
New Developer
Posts: 17
Registered: ‎12-22-2008
My Device: Not Specified

Throws uncaught illegal argument exception when touch event occurs on empty tree field.

Hi,

I have tree field  and status bar displayed on the screen.

When tree is empty and first time any touch event occurs on the tree, it throws uncaught exception : illegal argument exception. If I first click on status bar and then on tree, then it works properly.

 

That uncaught exception throws when I call super.touchEvent().

 

How should I handle this exception?

 

If I return true inside touchEvent() by checking  node count for tree, then it doesn't take any touchEvent for status bar.

 

Here is the code what I have written,,,,

 

protected boolean touchEvent(TouchEvent message) {  
                int tmpTouchEvent = message.getEvent();
                if (tmpTouchEvent == TouchEvent.CLICK || tmpTouchEvent == TouchEvent.UNCLICK){
                    if(message.getY(1) < 0 || message.getY(1) > getHeight())
                        return true;
                    if( tmpTouchEvent == TouchEvent.UNCLICK)
                        return true;
                }
                return false;
            }

 

 

I m not diong any action for UNCLICK, for rest of events I want to take default tree actions.

Developer
Posts: 29
Registered: ‎03-17-2009
My Device: Not Specified

Re: Throws uncaught illegal argument exception when touch event occurs on empty tree field.

I ran into something similar, and ended up working around it by adding a dummy node, and then immediately removing it.  You might want to try that, if you can't fix it legitimately (seems like a bug on RIM's side to me).

 

Drew

Highlighted
Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: Throws uncaught illegal argument exception when touch event occurs on empty tree field.

Hi,

 

is it necessary to implement touchEvent() are you using FullScreen or MainScreen.

 

If you are using MainScreen then all touch events are automatically implemented.

 

 

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Throws uncaught illegal argument exception when touch event occurs on empty tree field.

What BlackBerry handheld software version are you testing on?  You can find this under Options, About on the BlackBerry Smartphone.

 

Can you provide the code snippet that is triggering the exception?  Where are you overriding touchEvent, at the field, manager or screen level?

 

 

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker