在android的webview中找不到文件

问题描述:

我已将我的静态web应用程序放置在资源文件夹中。我的静态Web应用程序有很多文件夹并放置在资源文件夹中。我从另一个HTML与子文件夹中调用HTML。我正在'找不到文件'。有人可以告诉我问题是什么吗?我下面张贴我的代码:在android的webview中找不到文件

wv=(WebView)findViewById(R.id.webView); 
     //wv.loadDataWithBaseURL("file:///android_asset/Opana_Changes/html/_assets/asset_001/index.html","","html"); 

     try { 
     InputStream is=getAssets().open("Opana_Changes/index.html"); 
     BufferedReader br=new BufferedReader(new InputStreamReader(is)); 
     String line = null; 
     while ((line = br.readLine()) != null) { 
      html=html+line; 
     } 
     br.close(); 

    } catch (IOException e) { 
     // TODO Auto-generated catch block 
     e.printStackTrace(); 
    } 

      wv.loadDataWithBaseURL("file:///android_asset/Opana_Changes/",html,"text/html", "UTF-8",null); 


     wv.getSettings().setJavaScriptEnabled(true); 
     } 

尝试下面的代码,如果你的HTML文件的资产文件夹意味着资产有Opana_Changes文件夹和Opana_Changes你有你的HTML文件。它会工作。

wv=(WebView)findViewById(R.id.webView); 

wv..loadUrl("file:///android_asset/Opana_Changes/index.html"); 

如果我的回复对您有帮助,请不要忘记投票。

file:///android_asset gives you path upto assets folder. 

你可以给您的文件所在

感谢 迪帕克

确切的文件夹结构