Responsive Ad Area

Share This Post

test

I can’t able to go to previous page on Webview and OnBackPressed() is not working in WebView

This is my code on webActivity.Im passing the URL from Resource Activity to WebActivity.Please guide me where In Which Activity I should put that code i.e Resource Activity??

  pu
   @Overrideblic class WebActivity extends AppCompatActivity {


private WebView mwebview;
private ProgressDialog progressBar;

protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.webview);
    final WebView mwebview = (WebView) findViewById(R.id.webview);

    WebSettings webSettings = mwebview.getSettings();
    mwebview.setWebViewClient(new WebViewClient());
    webSettings.setJavaScriptEnabled(true);

    String uri = getIntent().getExtras().getString("uri");

    mwebview.loadUrl(uri);

    String auri = getIntent().getExtras().getString("auri");
    mwebview.loadUrl(auri);
    String huri = getIntent().getExtras().getString("huri");
    mwebview.loadUrl(huri);
    String eouri = getIntent().getExtras().getString("eouri");
    mwebview.loadUrl(eouri);
    String houri = getIntent().getExtras().getString("houri");
    mwebview.loadUrl(houri);
    String bouri = getIntent().getExtras().getString("bouri");
    mwebview.loadUrl(bouri);





    }

//My OnBackPressed Code

    public void onBackPressed() {
    if (mwebview.canGoBack())
    mwebview.goBack();
    else
    super.onBackPressed();

}

}


I can’t able to go to previous page on Webview and OnBackPressed() is not working in WebView
I can’t able to go to previous page on Webview and OnBackPressed() is not working in WebView
test
{$excerpt:n}

Share This Post

Leave a Reply

Your email address will not be Publishedd. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Skip to toolbar