title: How to get a java.io.File from R.raw resource
body: <p>I added a raw resource to my Android Studio project:</p>
  
  <p>Then I need to get a <code>java.io.File</code> instance pointing to it.</p>
  
  <p>I have tried three things, but file cannot be found and <code>File.exists()</code> is equal false:</p>
  
  <pre><code>// Option 1:
  //
  //     com.example.myapp:raw/plano_metrobus
  //
  val fileName = resources.getResourceName(R.raw.plano_metrobus)
  Log.w("xxx", fileName)
  Log.w("xxx", File(fileName).exists().toString())
  
  // Option 2
  //
  //     android.resource://com.example.myapp:raw/plano_metrobus
  //
  val uri = Uri.parse("android.resource://" + fileName)
  Log.w("xxx", uri.toString())
  Log.w("xxx", File(uri.toString()).exists().toString())
  
  // Option 3
  //
  //     android.resource://com.example.myapp/2131427328
  //
  val uri2 = Uri.parse("android.resource://" + packageName + "/" + R.raw.plano_metrobus)
  Log.w("xxx", uri2.toString())
  Log.w("xxx", File(uri2.toString()).exists().toString())
  </code></pre>
  
  <p>What is the right way to create a <code>File</code> object?</p>