简体   繁体   中英

How do I delay onCreateOptionsMenu(Menu menu)?

Im a creating and options menu dynamically, the option menu depends on data that is created during the onCreate() stage.

The problem is that onCreateOptionsMenu() is called before the data is created. Is there a way to execute after onCreate()?

Thanks Fabii

You can use invalidateOptionsMenu() , but it requires API level 11.

Also, you can choose to override onPrepareOptionsMenu() instead, which will give you to opportunity to modify the menu before it is displayed each time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM