If you are trying to select an Item of the Navigation drawer in the onCreate Method or anywhere else in your application, you can use the code below:
navigationView.getMenu().getItem(0).setChecked(true);
The getItem(int index) method gets the MenuItem then you can call the setChecked(true);on that MenuItem, all you are left to do is to find out which element index does the default have, and replace the 0 with that index.
You can select(highlight) the item by calling
onNavigationItemSelected(navigationView.getMenu().getItem(0));
Android NavigationDrawer how to select an item at startup?
Unknown
Android Developer at Appsix LLC
I love stickers and reading books.
A cool website that I've found was commitstrip.com
Currently reading: The pragmatic programmer, and The C programming language.
Currently working: an android app, and on a web project with laravel.
Im a 9gag enthusiast.
I write code at work and at home for fun or out of pure boredom.
Programming Languages that I've worked with:
Java
PHP
C#
PLSQL
JavaScript
Thanks for reading.
“Benjamin Briel Lee was very professional at all times, keeping me aware of everything that was happening, If I had any questions he was always available to answer. This was my first home purchase, I didn’t know much about the loan process, he made it very easy to understand the things I had questions about. I really enjoyed working with him.”
ReplyDeleteHe's a loan officer working with a group of investor's who are willing to fund any project or loan you any amount with a very low interest.Contact Benjamin Briel Lee E-Mail: lfdsloans@outlook.com Whats-App Number: +1-989-394-3740.
thanks for sharing this information. Full Stack Classes In Pune
ReplyDelete