android - How to add GoBackSupport to three WebView Fragments? -


this situation: have three webview fragments , if press backbutton application closes. want these webview fragments goback previous page. tried:

@override     public boolean onkeydown(int keycode, keyevent event) {          if ((keycode == keyevent.keycode_back) && webview.cangoback()) {             webview.goback();             return true;         }          return super.onkeydown(keycode, event);     } 

but still does not work in fragments. how make these webview fragments goback?

addition: handle navigationdrawer, there code in mainactivity.class:

@override      public void onbackpressed() {          drawerlayout drawer = (drawerlayout)  findviewbyid(r.id.drawer_layout);          if (drawer.isdraweropen(gravitycompat.start)) {              drawer.closedrawer(gravitycompat.start);              } else {              super.onbackpressed();          }        } 

@override public boolean onbackpressed() {         webview.goback();         return true; } 

try this


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo