Android devs | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Android devs

Hi guys, I'm just learning android. Can u say me what's the difference between onoptionsitemselected() vs onnavigationitemselected(). Saw these two are used in different examples for navigation drawer. First function i used to open and close nav. With second function to get each selected item. So nav can close and open without first function? Please help to understand what's going on.

1st Sep 2022, 7:06 PM
Galstyan
Galstyan - avatar
3 Answers
+ 2
Hi I am an Android dev To answer your question on optionitemselected() is used to listen to an object in a menu or a navigation drawer etc. On the other hand on navigationitemselected is used to listen if a navigation bar item is selected
1st Sep 2022, 8:34 PM
🥇👩‍💻 Kintu Michael Evans 🔥🔥( Active)
🥇👩‍💻 Kintu Michael Evans 🔥🔥( Active) - avatar
+ 2
Are you using Jetpack Compose or XML?
1st Sep 2022, 7:50 PM
Justice
Justice - avatar
0
2nd Sep 2022, 5:09 AM
Galstyan
Galstyan - avatar