开发者

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

开发者 https://www.devze.com 2023-03-28 09:42 出处:网络
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

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

精彩评论

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