1. AC Question's Avatar
    I've implemented below code and its working for single fragment but need to know how to make it work for different fragments?
    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (event.getAction() == KeyEvent.ACTION_DOWN) {
    switch (keyCode) {
    case KeyEvent.KEYCODE_BACK:
    if (fragment1.mWebView.canGoBack()) {
    fragment1.mWebView.goBack();
    } else {
    finish();
    }
    return true;
    }
    }
    return super.onKeyDown(keyCode, event);
    }

    I've made the mWebView public to get it and its working for fragment1 but how to make this same function work for different fargments?
    05-16-2016 01:24 AM

Similar Threads

  1. Going back to Note 5?
    By crazyralph90 in forum Samsung Galaxy S7 edge
    Replies: 5
    Last Post: 05-17-2016, 08:03 PM
  2. Retrieve an old pin
    By AC Question in forum Ask a Question
    Replies: 1
    Last Post: 05-16-2016, 01:10 AM
LINK TO POST COPIED TO CLIPBOARD