title: How to get an uri from a raw resource
body: <p>I have a .txt file inside my raw folder. I want to get the uri of the file and create a new file to upload to firebase.</p>
  
  <p>The idea is simple</p>
  
  <ol>
  <li>Get the txt file from my res/raw resources</li>
  <li>Upload it to firebase storage</li>
  </ol>
  
  <p><strong>I have done this</strong> </p>
  
  <pre><code> String path = "android.resource://" + getPackageName() + "/" + "raw/grupos.txt";
  
   Uri file = Uri.fromFile(new File(path));
  </code></pre>
  
  <p><strong>but when I call</strong> </p>
  
  <pre><code>riversRef.putFile(file)
                  .addOnSuccessListener(new OnSuccessListener&lt;UploadTask.TaskSnapshot&gt;() {....
  </code></pre>
  
  <p><strong>it says that the file is invalid</strong> </p>
  
  <p><strong>LOGCAT</strong></p>
  
  <blockquote>
    <p>java.io.FileNotFoundException:
    /android.resource:/com.example.usuario.ottasubirarchivos/raw/grupos.txt:
    open failed: ENOENT (No such file or directory)</p>
  </blockquote>
  
  <p>I don't know if I need to get the path of the resource file, create a new file inside the internal storage, get that file and upload it to firebase, or either use stream... I don't know how to handle this... Thanks</p>