android - How do I add user details on Navigation Drawer from database -
drawerlayout drawer = (drawerlayout) findviewbyid(r.id.drawer_layout); actionbardrawertoggle toggle = new actionbardrawertoggle( this, drawer, toolbar, r.string.navigation_drawer_open, r.string.navigation_drawer_close); drawer.setdrawerlistener(toggle); toggle.syncstate(); navigationview navigationview = (navigationview) findviewbyid(r.id.nav_view); navigationview.setnavigationitemselectedlistener(this); view header=navigationview.getheaderview(0); hashmap<string,string>user=db.getuserdetails(); string user_name=user.get("name"); string user_email=user.get("email"); textview _name=(textview)header.findviewbyid(r.id.sname); textview _email=(textview)header.findviewbyid(r.id.semail); _name.settext(user_name); _email.settext(user_email);
wiki
Comments
Post a Comment