Search code examples
androidactionbarsherlockachartengineandroid-tabs

onCreateOptionsMenu() is called twice when switching tabs and OnOptionItemSelected() is not called


I have 3 tabs in my application using actionbarSherlock and achartengine library in the app too: Its like when i start my application and move from the home tab to the 2nd tab or even if i move to 3rd tab the my onCreateOptionsMenu() is called twice due to which onOptionItem Selected is never called and its called when i go to 3rd tab and come back to the 2nd tab then onCreateOptions menu is called only once and then onOptionItemSelected is called.

Total of 3 tabs in an application using action bar sherlock and achartengine library

case 1: moving from 1st Tab ---->>>> 2nd tab : onCreateOptionsMenu() is called twice and onOptionItemSelected() is not called

case 2: moving from 1st Tab ---->>>> 3rd tab : onCreateOptionsMenu() is called twice and onOptionItemSelected() is not called

case 3: moving from 1st Tab ---->>>> 3rd tab --->>>2nd Tab : onCreateOptionsMenu() is called once and onOptionItemSelected() is also called

case 4: moving from 1st Tab ---->>>> 2nd tab --->>> 3rd Tab : onCreateOptionsMenu() is called once and onOptionItemSelected() is also called

Please suggest me a solution to this problem. Its been 4-5 days since the issue is troubling me.


Solution

  • I have finally found a solution to it and its Still an open issue and not yet have been fixed by the inventors and developers. :-))