Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

avoid showing menu on button click

In my application there is a button and when the button is clicked the context menu pops up. How can I avoid having the context menu show up?

protected void makeMenu(Menu menu, int context){
    menu.add(_imageMenuItem);
    super.makeMenu(menu, context);
}

class ImageMenuItem extends MenuItem {      
    ImageMenuItem() {
        super("Login Screen", 0, 0);            
    }
    public boolean onMenu(int i) {
        return false;
    }

    public void run() {
        UiApplication app = (UiApplication) getApplication();
        app.pushScreen(new LoginScreen());
    }
}
like image 204
Jisson Avatar asked Feb 07 '11 07:02

Jisson


1 Answers

have you added style to the ButtonField via the constructor?

ButtonField button = 
    new ButtonField("text", Field.H_CENTRE|ButtonField.CONSUME_CLICK);
like image 110
Adil Soomro Avatar answered Sep 19 '22 23:09

Adil Soomro