Question

Je construis une application factice pour voir comment cela fonctionne l'alarme de la poussette, mais je ne le fais pas fonctionner. Quand je l'exécute, je ne vois rien ...

aucune idée?

Voici mon code (Lwuit avec SDK 2.0, S40)

package mobileapplication2;

import com.sun.lwuit.Display;
import com.sun.lwuit.Form;
import com.sun.lwuit.Label;
import javax.microedition.io.ConnectionNotFoundException;
import javax.microedition.io.PushRegistry;
import javax.microedition.midlet.*;

/**
 * @author S40
 */
public class Midlet extends MIDlet implements Runnable {

    public Midlet() {
        Display.init(this);
    }

    public void startApp() {
        Display.getInstance().callSerially(this);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }

    public void run() {
        try {
            PushRegistry.registerAlarm(getClass().getName(), System.currentTimeMillis() + 100000);
            Form f = new Form("Example");
            f.addComponent(new Label("HOLA"));
            f.show();
        } catch (ClassNotFoundException ex) {
            System.out.println("NOT FOUND");
            ex.printStackTrace();
        } catch (ConnectionNotFoundException ex) {
            System.out.println("CONNECTION");
            ex.printStackTrace();
        }
    }
}

Était-ce utile?

La solution

Je l'obtiens enfin fonctionnant

Ceci est mon code final si vous voulez jeter un coup d'oeil

            java.util.Calendar cal = Calendar.getInstance();
            cal.setTimeZone(TimeZone.getTimeZone("GMT"));
            cal.set(Calendar.MONTH, Calendar.NOVEMBER);
            cal.set(Calendar.DAY_OF_MONTH, 18);
            cal.set(Calendar.AM_PM, Calendar.PM);
            cal.set(Calendar.HOUR_OF_DAY, 15);
            cal.set(Calendar.MINUTE, 27);
            cal.set(Calendar.SECOND, 0);
            System.out.println("CALE " + cal.getTime().toString());
            Date d = new Date();
            long l = PushRegistry.registerAlarm(getClass().getName(), cal.getTime().getTime());

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top