简体   繁体   中英

How to know if onCreateOptionsMenu has finished

I want to know if there's any way in Android to programatically know if
public boolean onCreateOptionsMenu(Menu menu) has been called and returned.

I'm using actionsherlockbar library in a project and the app has to download some content and I'd like to start the download when the action bar is loaded so I can use its integrated progress interface, but I can't find a way since onCreateOptionsMenu is called after onCreate.

To sum up, hat I want to do is:

-load the actionBar -notice it is loaded -enable the progress bar -download -disable the progress bar

But I don't know how to notice it's loaded.

Thanks in advance for your help.

use Log.d() method to register in the logcat. eg:

in your case:

where you have defined the onCreateOptionsMenu() add this command:

Log.d("tag of your choice", "value you want to check if it has been initialized");

You can see more about this function in eclipse or https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCwQFjAA&url=http%3A%2F%2Fdeveloper.android.com%2Freference%2Fandroid%2Futil%2FLog.html&ei=3RIfUqaCGcS4rgf19ICQCg&usg=AFQjCNEd4hTMzjI2BnTS2woBfjvrddoQsw&sig2=4JDVD0JjIjx0mEhog9plPQ&bvm=bv.51495398,d.bmk

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