Domanda

Posso assegnare il Exit Comando al # Chiave in un'applicazione Lwuit? Quando premo il tasto #, il Exit Il comando deve essere chiamato automaticamente ed uscire dall'applicazione.

È stato utile?

Soluzione

Dovresti ascoltare un evento KeyPress o KeyReleased sul modulo con il codice chiave per # ed esciplicazioni quando viene premuto il tasto #.

protected void keyPressed(int key)
{
    System.out.println("Key Pressed");

    if(key==52) //change 52 to match keyCode for # key 
    {
      Display.getInstance().exitApplication();
    }
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top