Quantcast
Channel: onCreateOptionsMenu is never called - Stack Overflow
Viewing all articles
Browse latest Browse all 13

Answer by AnthonyCFE for onCreateOptionsMenu is never called

$
0
0

I had a similar issue, but a different solution I am sharing with the community (as it took me one hour to understand what was happening):

    abstract class BaseActivity : AppCompatActivity{      override fun onCreate(savedInstanceState: Bundle?) {      setSupportActionBar(my_toolbar)      }    }    class MyActivity : BaseActivity{        // TODO : some good stuff    }

where my_toolbar is an object created in my xml file through dataBinding.

The issue looks the same, no toolbar appear, no call to onCreateOptionsMenu.

My solution was to promote this code to the child class and not to that basic, as my_toolbar is only initialized as the child class is built.


Viewing all articles
Browse latest Browse all 13

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>