开发者

How do I create a new menu in Android to undertake a certain action without opening up another preference window?

If you click a button on the menu it opens up an XML preference window, but I just want the button to call another method that creates开发者_运维百科 a record in my sqlite database.


Why don't you just call this method in onCreateOptionsMenu() and do not inflate menu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    createRecord();
    return false;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜