fix webview issue

This commit is contained in:
Page Asgardius 2022-09-12 15:04:37 -07:00
parent f4444d7595
commit b8fabcc1c6

View file

@ -9,15 +9,21 @@ import android.webkit.WebViewClient;
public class WebBrowser extends AppCompatActivity { public class WebBrowser extends AppCompatActivity {
private WebView npw; private WebView npw;
String webURL;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web_browser); setContentView(R.layout.activity_web_browser);
String webURL = getIntent().getStringExtra("web_url");
//This initializes webview object //This initializes webview object
npw =(WebView)findViewById(R.id.webview); try {
npw.setWebViewClient(new MyBrowser()); webURL = getIntent().getStringExtra("web_url");
npw.loadUrl(webURL); npw =(WebView)findViewById(R.id.webview);
npw.setWebViewClient(new MyBrowser());
npw.loadUrl(webURL);
} catch (Exception e) {
e.printStackTrace();
finish();
}
} }
private class MyBrowser extends WebViewClient { private class MyBrowser extends WebViewClient {