title: Android: how do I create File object from asset file?
body: <p>I have a text file in the assets folder that I need to turn into a File object (not into InputStream). When I tried this, I got "no such file" exception:</p>
  
  <pre><code>String path = "file:///android_asset/datafile.txt";
  URL url = new URL(path);
  File file = new File(url.toURI());  // Get exception here
  </code></pre>
  
  <p>Can I modify this to get it to work?</p>
  
  <p>By the way, I sort of tried to "code by example" looking at the following piece of code elsewhere in my project that references an HTML file in the assets folder</p>
  
  <pre><code>public static Dialog doDialog(final Context context) {
  WebView wv = new WebView(context);      
  wv.loadUrl("file:///android_asset/help/index.html");
  </code></pre>
  
  <p>I do admit that I don't fully understand the above mechanism so it's possible that what I am trying to do can't work.</p>
  
  <p>Thx!</p>