Android Close Current Activity From Webview
This problem fixed This problem fixed
Solution 1:
If you can redirect on button click something
then
onClick="document.location.href='http://exitme';".
Then in your shouldOverrideUrlLoading method, you can intercept that URL and exit the app.
@OverridepublicbooleanshouldOverrideUrlLoading(WebView view, String url)
{
if (url.contains("http://exitme")
finish(); // close activityelse
view.loadUrl(url);
returntrue;
}
Solution 2:
You have to inject JS interface
in your WebView
. Here is an example, how to catch button click in your HTML
page and catch this action in Java (Android)
.
Solution 3:
just Call finish();
inside the Activity class
Post a Comment for "Android Close Current Activity From Webview"