1

I am trying to load a html into webview.

The following didnt work for me:

     webView.loadUrl("file:///assets/index.html");
     webView.loadUrl("file:///android_assets/index.html");

index.html actual path in my mac is :

   app/src/main/assets/www/index.html

I even tried:

   webView.loadUrl("app/src/main/assets/www/index.html");
   webView.loadUrl("/app/src/main/assets/www/index.html");
   webView.loadUrl("~/app/src/main/assets/www/index.html");

I also tried by copying the original file path:

webView.loadUrl("/Users/VenkataManiteja/Desktop/MaterialTabs/app/src/main/assets/www/index.html");

webView.loadUrl("file:///Users/VenkataManiteja/Desktop/MaterialTabs/app/src/main/assets/www/index.html");

But the webview cant find my file.

What is the proper way to give the file path ?

The following is displayed in logcat:

 01-28 16:48:34.452 20737-20752/info.androidhive.materialtabs E/eglCodecCommon: glUtilsParamSize: unknow param 0x00000b44
01-28 16:48:34.452 20737-20752/info.androidhive.materialtabs E/eglCodecCommon: glUtilsParamSize: unknow param 0x00000bd0
01-28 16:48:34.462 20737-20752/info.androidhive.materialtabs E/eglCodecCommon: **** ERROR unknown type 0x0 (glSizeof,72)
01-28 16:48:34.472 20737-20752/info.androidhive.materialtabs E/eglCodecCommon: glUtilsParamSize: unknow param 0x00000b44
01-28 16:48:34.482 20737-20752/info.androidhive.materialtabs E/eglCodecCommon: glUtilsParamSize: unknow param 0x00000bd0
01-28 16:48:34.512 20737-20752/info.androidhive.materialtabs E/eglCodecCommon: **** ERROR unknown type 0x0 (glSizeof,72)
01-28 16:48:34.522 20737-20752/info.androidhive.materialtabs E/eglCodecCommon: glUtilsParamSize: unknow param 0x00000b44
01-28 16:48:34.532 20737-20752/info.androidhive.materialtabs E/eglCodecCommon: glUtilsParamSize: unknow param 0x00000bd0
01-28 16:48:34.542 20737-20752/info.androidhive.materialtabs E/chromium: [ERROR:buffer_manager.cc(313)] [.Parent-Compositor-0x7fd5bc907b00]GL ERROR :GL_INVALID_OPERATION : glBufferData: <- error from previous GL command
01-28 16:48:34.552 20737-20752/info.androidhive.materialtabs E/eglCodecCommon: **** ERROR unknown type 0x0 (glSizeof,72)
01-28 16:48:34.562 20737-20752/info.androidhive.materialtabs E/eglCodecCommon: glUtilsParamSize: unknow param 0x00000b44
01-28 16:48:34.572 20737-20752/info.androidhive.materialtabs E/eglCodecCommon: glUtilsParamSize: unknow param 0x00000bd0
01-28 16:48:34.582 20737-20752/info.androidhive.materialtabs E/eglCodecCommon: **** ERROR unknown type 0x0 (glSizeof,72)
01-28 16:48:34.582 20737-20752/info.androidhive.materialtabs E/eglCodecCommon: glUtilsParamSize: unknow param 0x00000b44
01-28 16:48:34.582 20737-20752/info.androidhive.materialtabs E/eglCodecCommon: glUtilsParamSize: unknow param 0x00000bd0
01-28 16:48:34.592 20737-20752/info.androidhive.materialtabs E/eglCodecCommon: **** ERROR unknown type 0x0 (glSizeof,72)

enter image description here

enter image description here

Prags
  • 2,457
  • 2
  • 21
  • 38
Teja Nandamuri
  • 11,045
  • 6
  • 57
  • 109
  • Check the answers to [this](http://stackoverflow.com/questions/11820142/how-to-pass-a-file-path-which-is-in-assets-folder-to-filestring-path) question – Jim Rhodes Jan 28 '16 at 22:16
  • @Teja Nandamuri, can you check this answer and let me know. – Prags Dec 08 '17 at 09:16

1 Answers1

1

As i have seen in this screenshot your index.html in WWW folder so you can use this code.i have tested this pice of code on mac

    WebView myWebView = (WebView) findViewById(R.id.webview);
    WebSettings webSettings = myWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    myWebView.loadUrl("file:///android_asset/www/index.html");

Please let me know if any concern you have.

Prags
  • 2,457
  • 2
  • 21
  • 38