Sign in to follow this  

Command Listener Options.

This topic is 4087 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys. I'm having some trouble here with this. I created an option for the menu of the softkeys, but, when i try it in any mobile hand set, it doesn't appear. What's wrong with it? Thanks
[source code=javax]
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class MainBase extends MIDlet implements CommandListener
{
	private Display desplegar;
	private Command comandoSalir;//Comando de Salida
	private GameAlfaClass comic;
	public int opcion=99;
	public boolean isPlay=true;
	public boolean isOut=true;
	public void startApp() throws MIDletStateChangeException
	{
		desplegar = Display.getDisplay(this);
		program=new GameAlfaClass(this);
		comandoSalir = new Command("Correr",Command.EXIT,2);
		program.addCommand(comandoSalir);
		program.setCommandListener(this);
		try
		{
			program.start();
			desplegar.setCurrent(comic);    
			isOut = true;
			while (isOut){}    
			program.stop();
			program = null;

		}
		catch (Exception ex)
		{
			System.out.println(ex);
			
		}
		notifyDestroyed();
	}
	public Display getDisplay()
	{
		return desplegar;  
	}
	public void pauseApp()
	{
		program.stop();
		
		try { Thread.sleep(1000); }//esperar medio segundo para dar consistencia
		catch (InterruptedException ie) {}
	}
	public void destroyApp(boolean unconditional)
	{
		program.stop();
		
		try { Thread.sleep(1000); }//esperar medio segundo para dar consistencia
		catch (InterruptedException ie) {}
		
	}
	public void commandAction(Command c, Displayable s) 
	{
		if (c == comandoSalir) 
		{
			destroyApp(true);
		} 
	}
}





[/source code]

Share this post


Link to post
Share on other sites

This topic is 4087 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this