OnCreateOptionsMenu () is called twice when switching tabs, and OnOptionItemSelected () is not called

I have 3 tabs in my application using the actionbarSherlock and achartengine panel in the application: for example, when I launch my application and switch from the home tab to the second tab, or even if I switch to the 3rd tab, my onCreateOptionsMenu() is called twice, due to which onOptionItem Selected is never called and it is called when I go to the 3rd tab and return to the second tab, then the onCreateOptions menu is onCreateOptions only once, and then onOptionItemSelected .

Only 3 tabs in the application using action bar sherlock and achartengine library

case 1 : transition from the first tab ---- → → Second tab: onCreateOptionsMenu() is called twice, but onOptionItemSelected() not called

case 2 : transition from the first tab ---- → → Third tab: onCreateOptionsMenu() is called twice and onOptionItemSelected() not called

case 3 : transition from the first tab ---- → → 3rd tab --- →> Second tab: onCreateOptionsMenu() is called once and onOptionItemSelected() also called

case 4 : transition from the first tab ---- → → 2nd tab --- →> Third tab: onCreateOptionsMenu() is called once and onOptionItemSelected() also called

Please offer me a solution to this problem. Its been 4-5 days since the problem bothers me.

+4
source share
1 answer

Finally, I found a solution for it and its still open problem and has not yet been fixed by the inventors and developers. :-))

-1
source

Source: https://habr.com/ru/post/1439744/


All Articles