Thanks.
I did create a contentProvider with a single asset file.
I also tried ParcelFileDescriptor
@Override
public ParcelFileDescriptor openFile(Uri uri, String mode) throws
FileNotFoundException{
...
ParcelFileDescriptor parcel = ParcelFileDescriptor.open(file,
ParcelFileDescriptor.MODE_READ_ONLY);
return parcel;
}
but could not make it work. Then thought just making a regular app
would be less tricky.
Now I do have the app which WRITES a worldReadable file that I can
read from my other app.
But there is that extra step I am trying to avoid.
I understand reading the asset file may be impossible.
Would it be easier if I read a raw file?
Or should I definitely go back to making a content provider and try to
read its asset?
Thank you very muchfor your help.
On Dec 3, 8:34 am, Nikolay Elenkov <[email protected]> wrote:
> On Sun, Dec 4, 2011 at 1:23 AM, Saied <[email protected]> wrote:
>
> > fIn = (FileInputStream) this.createPackageContext(packageName,
> > 0).getResources().getAssets().open("asset_text.txt");
>
> > this did not work.
>
> > What's a trick to reading an asset file of a different package?
>
> Do tell us the actual error/stacktrace, but this is probably impossible.
> Assets are not actual files, stored in the app's directory, and
> I don't think there is no way to set permissions or read them
> from another application. If you need to share files copy/extract
> them to the SD card (external storage), or just spend some time
> on writing an ContentProvider.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en