Tuesday, 2 August 2011
App or game not getting pause
//Application or game not getting pause in some devices
//hideNotify() and showNotify() not calling.....on interruption...
Hi
If the application and game not getting pause on call interruption.
//class :> sample extends canavas
.
.
//hideNotify() and showNotify() not calling.....on interruption...
Hi
If the application and game not getting pause on call interruption.
//class :> sample extends canavas
.
.
/* this time is depend on your code written in paint method
delay = “time required to compute any calculation in paint” + “time required by rendering full canvas” game frame” in milliseconds.” + add some additional 50ms */
long delay = 500;
public void paint(Graphics g){
long Starttime = System.currentTimeMillis();
// your code for paint
if( (System.currentTimeMillis()-Starttime) > delay ){
hideNotify
()
;// activate pause code written in hideNotify //like
pauseApp
()
of midlet.showNotify
();// active pause screen of game
}
}
Note:
If your game get auto paused frequently then change delay value
- if auto pause frequently increase value of delay.
- if game not getting pause on interruption then decrease value of delay.
Gain saturated value of delay for device and paint logic and it will work.
Subscribe to:
Posts (Atom)