android


ActionBarDrawerToggle in activity breaks options menu in fragments


I have Toolbar and DrawerLayout with NavigationView in activity, and OptionsMenu in fragments. I use ActionBarDrawerToggle with toolbar to have hamburger item:
setSupportActionBar(binding.includedAppBarLayout.toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayShowTitleEnabled(false);
}
drawerToggle = new ActionBarDrawerToggle(this,
binding.drawerLayout,
binding.includedAppBarLayout.toolbar,
R.string.navigation_drawer_open,
R.string.navigation_drawer_close);
And after that I assign drawerToggle to drawerLayout:
binding.drawerLayout.addDrawerListener(drawerToggle);
Then, I put fragments in activity's content area below toolbar, and call setHasOptionsMenu(true) inside fragment's onCreate() method.
Fragments get their menus inflated and set up but they never get displayed on activity's toolbar.
BUT, if I remove drawerListener(drawerToggle) from drawerLayout, Options Menu works well, but no hamburger icon accordingly.
SOLUTION Actually this was my fault from the beginnig. I found that I had another Toolbar inside fragments, that's why drawerToggle wasn't working properly.

Related Links

Can I catch Exception in C in android NDK?
how to use Service
Android VideoView repetition
How to read more than one column in database by cursor and fill into a list?
Is there a way to set up an initial orientation for the Android device
How to draw touch-enabled rect in Android
changing font style dynamically
How to create Vertical Carousel in android?
How to disable/hide three-dot indicator(Option menu indicator) on ICS handsets
progressbar in openGL android
How to handle the error: NativeStart.main(String[]) line: not available [native method] in Android
Display preview of camera using external camera
paste image on another image in android
How to use CalendarContract class in API Level 8
Get geo coordinates from JSON data and display them in google maps android
Integration or build instructions for libjpeg-turbo on Android

Categories

HOME
assembly
hyperlink
cheerio
android-studio-2.2
mysql-workbench
nuget
bitbucket-api
cublas
jquery-ui
android-json
frontend
discrete-mathematics
heap
startup
activecollab
cmdb
dimensional-modeling
nodemcu
rubymotion
visual-studio-extensions
fable-f#
rpgle
tizen-tv
uitapgesturerecognizer
powershell-ise
jett
vue-chartjs
sql-delete
engine.io
jpad
gdata
numberpicker
datacachefactory
dbnull
rfc3339
jquery-ui-draggable
globalize
manova
carrot2
android-testing
git-flow
type-theory
swingworker
filenet
centrifuge
drawstring
gogs
dynamics-nav-2016
toran-proxy
dynatree
phonertc
text-search
nsurlsessiondatatask
diff3
zxspectrum
showdialog
filesplitting
ghcjs
codeplex
mutual-authentication
sbcl
light
inputmismatchexception
jeromq
node-blade
http-status-code-410
subgraph
kqueue
virtualpathprovider
update-statement
massive
jqueryform
hbm2java
tui
scrubyt
flvplayback

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App