Last active
December 20, 2019 13:39
-
-
Save 6londe/4c552c71b2e8356b75cc to your computer and use it in GitHub Desktop.
Android webapp using webview : /assets/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WebViewActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
// full screen mode | |
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); | |
setContentView(R.layout.activity_web_view); | |
WebView myWebView = (WebView) findViewById(R.id.webview); | |
WebSettings webSettings = myWebView.getSettings(); | |
webSettings.setJavaScriptEnabled(true); | |
myWebView.loadUrl("file:///android_asset/index.html"); | |
myWebView.setWebViewClient(new WebViewClient() { | |
@Override | |
public boolean shouldOverrideUrlLoading(WebView view, String url) { | |
return false; | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment