So I just implemented my drawer and all the menu-i...
# android
j
So I just implemented my drawer and all the menu-items inside of it. I'm able to navigate between my fragments through the menu-items, however, if im in fragment A and click on the menu-item that takes me to fragment A, another view will be created on top of it. So I'm able to create several fragments on top of each other. How can I solve this?
r
Do fragment replace instead of add.
a
@Ryan is correct. Or better yet, try using
Navigation Component
. There are certain things you should know and learn when dealing with `FragmentTransaction`s as you may be doing something you dont expect. If you are not very comfortable with using
FragmentTransaction
, I would highly suggest you try
Navigation Component
instead so you wont deal with
FragmentTransaction
directly.