6

In my Activity I created a MenuItem that performs a clockwise animation in ActionBar when some data is loading. When loadData() is called the MenuItem has start the clockwise animation.

This works great, but when I first call loadData() inside onCreate callback the menuItem is not still available since onCreateOptionsMenu() has not been called yet, so my menuItem reference is still null and the animation can't start.

How can I handle this situation?

vjdhama
  • 4,878
  • 5
  • 33
  • 47
TheModularMind
  • 2,024
  • 2
  • 22
  • 36
  • 1
    Maybe this text from developer.android.com may help you: If you've developed your application for Android 2.3.x and lower, the system calls onCreateOptionsMenu() to create the options menu when the user opens the menu for the first time. If you've developed for Android 3.0 and higher, the system calls onCreateOptionsMenu() when starting the activity, in order to show items to the action bar. – Alejandro Alcalde May 03 '14 at 20:21
  • 1
    I'm targeting my app for Android 3.0 and higher, so the system should call onCreateOptionsMenu() when the activity starts – TheModularMind May 04 '14 at 19:27

0 Answers0