[android-developers] Re: How to READ a MODE_WORLD_READABLE file from ANOTHER application
Saied wrote:
> Thanks Pskink!
>
> Per your suggestion, I have created a content provider and tried this:
>
> @Override
> public AssetFileDescriptor openAssetFile1(Uri uri, String mode) {
> String fileName = "asset_text_orig.txt";
> ParcelFileDescriptor parcel = openAssetFile(fileName,
> ParcelFileDescriptor.MODE_READ_ONLY);
>
> return parcel;
> }
>
> there is a conflict as parcel type is ParcelFileDescriptor, but I
> need to return AssetFileDescriptor. How do I resolve that.
>
> And once this is corrected? How do I read this?
>
> Thanks.
>
> On Dec 3, 9:21 am, skink <psk...@gmail.com> wrote:
> > Saied wrote:
> > > 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.
> >
> > create custom ContententProvider and try to override openAssetFile()
> > method
> >
> > pskink
use this: developer.android.com/reference/android/content/res/
AssetManager.html#openFd(java.lang.String)
pskink
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home