RenatoMateusX
RenatoMateusX

Reputation: 7

How do I get my android webview make a load locally

I have a doubt. What happens is the following: I exported my game by using cocoonjs contruct 2, but I want to run it on my android webview by, because I want to implement starApp, and cocoonjs not support this. So, using my code below, I get only a blank screen. But in my launcher cocoonjs, this same project works normally, just that I select Canvas + can anyone help me?

web = (WebView) findViewById(R.id.webInicial); 
web.setWebChromeClient(new WebChromeClient()); 
web.getSettings().setJavaScriptEnabled(true); 
web.loadUrl("file:///android_asset/www/index.html");

Upvotes: 0

Views: 138

Answers (2)

CodyEngel
CodyEngel

Reputation: 1501

Have you tried getApplicationContext().getAssets().open("www/index.html");?

If that doesn't work, I'd say try the solutions in this post and let us know if it worked for you.

Upvotes: 0

amalBit
amalBit

Reputation: 12181

webView.loadData(yourData, "text/html", "UTF-8");

Where youData is the actual HTML data.

Upvotes: 0

Related Questions