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 Contributor
mastro
Posts: 5
Registered: ‎06-23-2011
My Device: Any blackberry device
My Carrier: any carrier
Accepted Solution

Midlet not responsive after sending the application in background and resuming it

Hi,

 

I have a midlet 2.0 application (no proprietary RIM api, just plain, compliant, midlet 2.0).

 

On blackberries (tried with two device, one 5.0 and one 6.0) If I switch from the application to the home screen and than back to the application the application is not responsive.

 

I use the "pointer of the device" to navigate to selectable elements or can click with touch.

The application is written with the gaming api.

 

After resume up/down/left/right or touch event are not triggered anymore.

If an element was left selected I can click and the application enter that element returning to work.

 

On Nokia devices this do not happen indicating there is something different happening in the blackberry.

 

I extended javax.microedition.lcdui.Canvas to handle keywords / touch events, draw on the screen through javax.microedition.lcdui.Graphics

 

I have two CustomCanvas in an array and switch between them to change page (so that I can load the new page in background before switching).

 

Every time a new request is issued, from my midlet class, extending javax.microedition.midlet.MIDlet, I do:

 

Display display = Display.getDisplay(this);

// do stuff here

display.setCurrent(newCanvas);

 

At initialization ( startApp() method from javax.microedition.midlet.MIDlet ) if it's the first time I create some instance of custom classing initializing them. 

 

I never again initialize them and do nothing on resumeApp() nor on startApp() if called after a resume.

 

Question are:

which kind of event can I get for background / foreground event on a midlet running on a blackberry?

and what should I re-initialize / check to handle these events?

 

Thanks,

Daniele

 

 

 

 

 

 

 

 

Please use plain text.
New Contributor
mastro
Posts: 5
Registered: ‎06-23-2011
My Device: Any blackberry device
My Carrier: any carrier

Re: Midlet not responsive after sending the application in background and resuming it

The problem was not related to blackberry... a little nasty bug happening only on blackberry for reason I can't explain...

If anything like this happen check where do you instantiate your Canvases and where do you keep them in memory...
should be consistent with startApp / stopApp...

If you don't remove the Canvas on stop then do not re-instantiate it in startApp if it's a resume.
Please use plain text.