enter code here
I am new to android development. I am currently working on an app where it uses webview. In that webview I am passing an url and when the url loads that corresponding page has a button inside the webpage that has the functionality to exit the Webpage. My requirement is to get the click function of that button. How is it possible to implement it in android. If anyone knows please help
<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
public class WebviewActivity extends Activity {
WebView web;
String rooId;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.webview);
Intent intent = getIntent();
rooId = intent.getStringExtra("RoomId");
Log.e("Roominer", "Roominer" + rooId);
web = (WebView) findViewById(R.id.webView1);
WebSettings settings = web.getSettings();
settings.setJavaScriptEnabled(true);
web.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
web.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Log.i("", "Processing webview url click...");
view.loadUrl(url);
return true;
}
public void onPageFinished(WebView view, String url) {
Log.i("", "Finished loading URL: " + url);
}
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Toast.LENGTH_SHORT).show();
}
}