Kousalya
Kousalya

Reputation: 760

How to go back to android application from a website?

By clicking a button in my activity, I am opening a webview using a url. From that website going to payment gateway. After completing payment it will be automatically redirect to website which I had opened in a webview. Now How should I go back to app again.Anybody give me better idea and ways to do that

Upvotes: 2

Views: 456

Answers (1)

Sandhiya
Sandhiya

Reputation: 359

 public boolean shouldOverrideUrlLoading(WebView view, String url) {
               if(url.contains("returnToHome"))
                    finish();
                return false; // then it is not handled by default action
            }

If there is any url change you can find it with this method. You want to decide in which url you want to go back. By checking the parameter of the url you can go back..Hope this helps you..

Upvotes: 2

Related Questions