user386430
user386430

Reputation: 4967

how to run local web application in android webview

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

Upvotes: 1

Views: 3061

Answers (2)

kiswa
kiswa

Reputation: 14987

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.

Upvotes: 2

Benny Skogberg
Benny Skogberg

Reputation: 10681

Just run your application on the emulator, as you normally do (and be sure to have your computer connected to internet).

Upvotes: 0

Related Questions