Domanda

Questa è la mia classe, molto semplice:

public class SelectYesNoArea extends Manager {

    BitmapField yes;
    BitmapField no;
    DateField date;
    Calendar cal;

    public SelectYesNoArea(long style){
        super(style);           

        Bitmap bgPic = Bitmap.getBitmapResource("divBackgrounds.png");
        Background bg = BackgroundFactory.createBitmapBackground(bgPic);
        setBackground(bg);

        cal = Calendar.getInstance();               
        date = new DateField("",cal.getTime().getTime(), DateFormat.DATE_SHORT);
        add(date);

        Bitmap bitYes = Bitmap.getBitmapResource("yes.png");
        yes = new BitmapField(bitYes);
        add(yes);

        Bitmap bitNo = Bitmap.getBitmapResource("no.png");
        no = new BitmapField(bitNo);
        add(no);
    }   
}

Voglio solo da gestire quando un utente tocca sul BitmapField. Come posso fare questo?

È stato utile?

Soluzione

Utilizza una classe anonima:

yes = new BitmapField(bitYes) {
    trackwheelClick(int status, int time) {
        Do whatever you want here !
    }
}

Altri suggerimenti

Prova a usare lo stile Field.FOCUSABLE quando si crea il BitmapField.

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