0

I am developing a j2me application using canvas. In my application I have 3 canvas. I need to switch them regularly but sometimes I am facing problem either they don't switch or I got blank white screen

I use

display.setCurrent(maincanvas);

But still it's not working

gnat
  • 6,213
  • 108
  • 53
  • 73
Abhishek
  • 39
  • 2

1 Answers1

1
    Display.getDisplay(midlet).setCurrent(((MidletName)midlet).MethodName());   

in canvas whenever you want to switch your canvas code, you type this line. And Create Mehod in midlet, after you create object canvas. For example:

Splash hitSplash;
private Canvas gameView=null;
startApp() {
    hitSplash= new CanvasClass(this);
    Display.getDisplay(this).setCurrent(hitSplash);
} 
public Canvas getMenu1() 
{
    if (gameView!=null) gameView = null;
    gameView =  new CrackerWindow(this,getSplash());
    System.gc();
    return gameView;
}
private Splash getSplash() 
{
    return hitSplash;
}
gnat
  • 6,213
  • 108
  • 53
  • 73
ranjith
  • 99
  • 7