minor fixes
This commit is contained in:
parent
66d545e734
commit
1582de593e
@ -16,25 +16,19 @@ public class MainActivity extends Activity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
mWebView = findViewById(R.id.activity_main_webview);
|
||||
|
||||
// Force links and redirects to open in the WebView instead of in a browser
|
||||
mWebView.setWebViewClient(new WebViewClient());
|
||||
|
||||
// Enable Javascript
|
||||
WebSettings webSettings = mWebView.getSettings();
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
|
||||
// REMOTE RESOURCE
|
||||
// mWebView.loadUrl("http://example.com");
|
||||
// mWebView.loadUrl("https://example.com");
|
||||
// mWebView.setWebViewClient(new MyWebViewClient());
|
||||
|
||||
// LOCAL RESOURCE
|
||||
// mWebView.loadUrl("file:///android_asset/index.html");
|
||||
}
|
||||
|
||||
// Prevent the back-button from closing the app
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if(mWebView.canGoBack()) {
|
||||
@ -43,5 +37,4 @@ public class MainActivity extends Activity {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -7,7 +7,6 @@ import android.webkit.WebViewClient;
|
||||
|
||||
class MyWebViewClient extends WebViewClient {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
Uri uri = Uri.parse(url);
|
||||
|
Loading…
Reference in New Issue
Block a user