In the main Activity there is a WebView , I want to upload a file there directly. And he pointed there like this:

 WebView webView = (WebView) findViewById(R.id.webView); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setBuiltInZoomControls(true); webView.loadUrl("file:///android_asset/index.htm"); 

But when I launch the program, it simply closes and opens the notebook, with the error that the file was not found. How can you beat it?

  • Is the file exactly in the assets folder? - Suvitruf
  • Yes. I will not specify a non-existent path - user271175
  • and instead of file on my assets you need to write - Dima Kalistratov
  • The path is correct. If I use ListView and I specify the path in it to load this file into WebView , then it will load without any problems. But in this way I can not directly download. - user271175

0