how to run local web application in android webview
-
26-09-2019 - |
Question
can anybody tell how to run the local webapplication using android webview
I want to run my own webpages in android using web view
Thanks
Solution
I'm guessing you want something like this:
private WebView mWebView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.yourLayoutWithAWebView);
mWebView = (WebView)findViewById(R.id.yourWebViewIdFromTheLayout);
mWebView.getSettings().setJavaScriptEnabled(true); // Enable JavaScript
mWebView.loadData(yourHtmlData, "text/html", "utf-8");
}
Hopefully, that at least points you in the right direction.
Also, I'd recommend reading the documentation on the WebView, it's pretty thorough.
OTHER TIPS
Just run your application on the emulator, as you normally do (and be sure to have your computer connected to internet).
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow