Share raw resource between apk's
<p>I have an apk (App1) that has a raw resource (res/raw/mytextfile.txt) and I would like to read that text file from another apk (App2).  I define a content provider in App1 and I override the <code>openFile(Uri, String)</code> method as follows:</p>

<pre><code>Resources res = getContext().getResources();
return res.openRawResourceFd(R.raw.mytextfile).getParcelFileDescriptor();
</code></pre>

<p>App2 does the following to try to get access to mytextfile.txt:</p>

<pre><code>ContentResolver cr = getApplicationContext().getContentResolver();
ParcelFileDescriptor fd = cr.openFileDescriptor(uri, "r");
InputStream is = new FileInputStream(fd.getFileDescriptor());
BufferedReader bis = new BufferedReader(new InputStreamReader(is));
</code></pre>

<p>However, when I read and write out the contents of the BufferedReader, I get way more than just the contents of mytextfile.txt.  Clearly I'm doing something wrong so I'd appreciate it if somebody could point me in the right direction.
Thanks,</p>

<p>Mirza</p>

<hr>

<p>I played with this some more and found that the file desriptor returned to App2 is pointing to the App1 apk file.  I wrote out the contents of the BufferedReader to a file and did a binary comparison to App1.apk.  The two files were identical.</p>
