Android onBackPressed dont work when DrawerLayout is opened -
in appliaction i'm using drawerlayout have sliding menu, want override onbackpressed
close drawerlayout if opend, or close application, onbackpressed
dont work when drawerlayout opend, must close , try again press button
@override public void onbackpressed() { if (mdrawerlayout.isdraweropen(ui.slide_menu)) { mdrawerstate = false; mdrawerlayout.closedrawer(ui.slide_menu); } if (g.back_pressed + 2000 > system.currenttimemillis()) { super.onbackpressed(); } else toast.maketext(g.context, r.string.press_once_again_to_exit, toast.length_short).show(); g.back_pressed = system.currenttimemillis(); }
try this,
if(mdrawerlayout.isdraweropen(gravity.left)) { mdrawerlayout.closedrawer(gravity.left); }
Comments
Post a Comment