cannot resolve method 'addDrawerListener(android.support.v7.app.ActionBarDrawerToggle)' -
package com.shafi.shafqat.listview; import android.support.design.widget.navigationview; import android.support.v4.widget.drawerlayout; import android.support.v7.app.actionbardrawertoggle; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.toolbar; import android.view.menuitem; import android.view.view; import android.widget.textview; import android.widget.toast; public class raweractivity extends appcompatactivity{ drawerlayout drawer; navigationview navview; toolbar toolbar; public void initnavdrawer(){ navview = (navigationview) findviewbyid(r.id.navigation_view); navview.setnavigationitemselectedlistener(new navigationview.onnavigationitemselectedlistener() { @override public boolean onnavigationitemselected(menuitem item) { switch (item.getitemid()){ case r.id.bikes: toast.maketext(getapplicationcontext(), "bikes selected", toast.length_short).show(); break; case r.id.accessories: toast.maketext(getapplicationcontext(), "accessories selected", toast.length_short).show(); break; case r.id.contact: toast.maketext(getapplicationcontext(), "contact selected", toast.length_short).show(); break; case r.id.login: toast.maketext(getapplicationcontext(), "log in selected", toast.length_short).show(); break; } return true; } }); toolbar = (toolbar) findviewbyid(r.id.toolbar); view header = navview.getheaderview(0); textview tv_email = (textview)header.findviewbyid(r.id.user_name); tv_email.settext("skshafqat@gmail.com"); drawer = (drawerlayout)findviewbyid(r.id.drawer_layout); actionbardrawertoggle actionbardrawertoggle = new actionbardrawertoggle(this,drawer,toolbar,r.string.drawer_open,r.string.drawer_close){ @override public void ondrawerclosed(view v){ super.ondrawerclosed(v); } @override public void ondraweropened(view v) { super.ondraweropened(v); } }; drawer.adddrawerlistener(actionbardrawertoggle); actionbardrawertoggle.syncstate(); } }
i tested same code yesterday , worked. when wanted combine code module highlights following drawer.adddrawerlistener(actionbardrawertoggle);
line in red. when hover on it, shows error cannot resolve method adddrawerlistener(android.support.v7.app.actionbardrawertoggle)
.
please help...
Comments
Post a Comment