Using a file located in either the raw or assets folder
<p>Currently I am able to download a file off the internet and store on the SD card, then use the file from there. However that makes the file (with proprietary data) available to be seen. I would prefer to use the file from somewhere like raw or assets folder. 
I will skip the downloading code, but my code to use the file is this</p>

<pre><code>  File myFile = new File (android.os.Environment.getExternalStorageDirectory() + "/folder/filename.xml");
  Intent myIntent = new Intent(Intent.ACTION_VIEW);
  myIntent.setData(Uri.fromFile(myFile));
</code></pre>

<p>Android opens the file with the default application and all is good.</p>

<p>I have found similar Q/A's that revolve around using code like</p>

<pre><code>  Uri.parse("android.resource://com.projectname.testing/raw/filename");
</code></pre>

<p>and</p>

<pre><code>  InputStream ins  = getResources().openRawResource(R.raw.filename);
</code></pre>

<p>but I can't work out how to get either of those two back into a 'file' format to be used with my .setData code</p>

<p>I would like to solve my problem by simply accessing the file as a file. However since it is being used by an external application I have read I might need to make a temporary copy of the file with mode_world_readable then delete it after the application closes. This sounds like a lot of extra work, especially since my code above does work for a file stored on the SD card.</p>

<p>Does anyone have any ideas?
Thanks</p>
