-1

So here's my problem. I made a website, which by popular demand, people want it to be an app on there phone (because apparently people are to lazy to google it and use precious internet :3 )

So I did some research and came across the android webview, and after a few tutorials I got my website working as an app. However this app still needed internet.

So I tried to just put my website files (Which are inside a folder called version) inside the android res folder

WebView/app/src/main/res/

But when I try to access it with the following code

    String url = "/res/version/english.html";
    WebView view = (WebView) this.findViewById(R.id.webView);
    view.getSettings().setJavaScriptEnabled(true);

    view.loadUrl(url);

It comes up with the "Webpage not available" message. Does anyone know how I can fix this. Thanks

Jonty Morris
  • 797
  • 1
  • 10
  • 25
  • possible duplicate of [Load local HTML file into WebView](http://stackoverflow.com/questions/5749569/load-local-html-file-into-webview) – Rick Sanchez Jul 05 '15 at 00:01
  • This is not a solution to your problem but probably a nice-to-have that makes your site display/work partially offline: http://www.html5rocks.com/en/tutorials/appcache/beginner/ – Machinarius Jul 05 '15 at 01:24

2 Answers2

1

My suggestion would be to look into Cardova or PhoneGap. They provide extremely robust tools to program with HTML, CSS, Javascript, etc and then acts as a native bridge between Java or Objective-C if you're developing for iPhone.

You will still have access to many of the core native API's such as Camera, Accelerometer, etc. My company uses these religiously as we mostly have web developers on staff. I would highly suggest it.

Zack Matthews
  • 409
  • 2
  • 11
1

I figured out what I did wrong. First off, I needed to add this at the start of it

"file:///"

Then I needed to make an assets folder, and then put all my files into it. And the last mistake, I need to access the access folder by doing this

"file://android_assest/*"
Jonty Morris
  • 797
  • 1
  • 10
  • 25