Jump to content
  • Advertisement
Sign in to follow this  
Goguigo

Command Listener Options.

This topic is 4375 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
Advertisement
Hey guys, i fixed it. :)

lol.

You just CAN't give an exit option without giving a CANCEL one... so, that's why it bringed up the conflict. Thanks anyway. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!