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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
New Contributor
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

 

 

 

 

 

 

 

 

Highlighted
New Contributor
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.