fix webview issue
This commit is contained in:
parent
f4444d7595
commit
b8fabcc1c6
1 changed files with 10 additions and 4 deletions
|
@ -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
|
||||||
|
try {
|
||||||
|
webURL = getIntent().getStringExtra("web_url");
|
||||||
npw =(WebView)findViewById(R.id.webview);
|
npw =(WebView)findViewById(R.id.webview);
|
||||||
npw.setWebViewClient(new MyBrowser());
|
npw.setWebViewClient(new MyBrowser());
|
||||||
npw.loadUrl(webURL);
|
npw.loadUrl(webURL);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MyBrowser extends WebViewClient {
|
private class MyBrowser extends WebViewClient {
|
||||||
|
|
Loading…
Reference in a new issue