Come posso utilizzare una finestra di dialogo con nessun pulsante e si chiude automaticamente? su BlackBerry

StackOverflow https://stackoverflow.com/questions/4348034

Domanda

ho bisogno di usare una finestra di dialogo. Che appare 2-3 secondi e dopo si chiude automaticamente. Quale oggetto dovrei usare su Blackberry?

È stato utile?

Soluzione

Creare una classe che estende PopupScreen e utilizzare un TimerTask per chiudere automaticamente esso. Così si avrebbe codice nel tuo costruttore che sembra un po 'come questo:

    Timer timer = new Timer();
    timer.schedule(new TimerTask(){

        public void run()
        {
            if(TestScreen.this.isDisplayed())
            {
                synchronized (Application.getEventLock())
                {
                    TestScreen.this.close();
                }
            }
        }

    }, WAIT_TIME_IN_MILLISECONDS);

Altri suggerimenti

è possibile utilizzare anche

Status.show(String message) 
  

mostra una schermata di stato per due secondi.

o

Status.show(String message, Bitmap bitmap, int time) 
  

mostra una schermata di stato con specificato   icona, per il tempo specificato.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top