-1

What I am trying to do is that when user click a button in a webview page, it starts a service and exit the webview(in animation way if possible).

Sathyajith Bhat
  • 21,321
  • 22
  • 95
  • 134
user822211
  • 343
  • 1
  • 6
  • 15

2 Answers2

2

If you have only 1 activity you can simply start the service and then call finish() on the activity. However, if you have multiple activities you have to make sure that you close them all (see also this post).

Community
  • 1
  • 1
THelper
  • 15,333
  • 6
  • 64
  • 104
0

You can exit the webView when a specific link is reached. I believe this solution will work in this case.

 WebViewClient webViewClient = new WebViewClient() {

        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            Log.e("PAGE_URL", url);
            if(url.equals("your link...")){
                finish();

            }
        }
    };