wow. that was dumb of me!! Thanks for pointing it out.

so I changed it to:

@Override
        public AssetFileDescriptor openAssetFile(Uri uri, String mode) {
                String fileName = "asset_text_orig.txt";       // hardcoding the
file name for now

                AssetManager assetManager = getAssets();
                AssetFileDescriptor afd = assetManager.openFd(fileName);
                return afd;
        }

and it WORKS!!

Thank you VERY much for your help and indulgence!

On Dec 4, 2:09 pm, skink <psk...@gmail.com> wrote:
> Saied wrote:
> > Thanks again!
>
> > Actually, this seems to be working on the ContentProvider now:
>
> > public AssetFileDescriptor openAssetFile(Uri uri, String mode) {
> >            String fileName = "asset_text_orig.txt";
> >            URI uri1 = URI.create(fileName);
> >            AssetFileDescriptor parcel =  this.openAssetFile(uri1, mode);  //
> > for testing purposes, I hardwired this to uri1 >
> > "asset_text_orig.txt";
> >            return parcel;
> >    }
>
> it will not work since you call openAssetFile recursively and you will
> get stack overflow error
>
>
>
>
>
>
>
>
>
> > Now, how do I read this from an app?
>
> >            String packageName = "com.example.text.cp";
> >            FileInputStream fstream = new FileInputStream("content://" +
> > packageName); // there is only one kind of file exposed
> >    DataInputStream in = new DataInputStream(fstream);
> >    BufferedReader br = new BufferedReader(new InputStreamReader(in));
> >    String strLine = br.readLine();
>
> >    ...
>
> > Or should I include openAssetFile(Uri uri, String mode) at the end of
> > the uri goint to FileInputStream?
>
> > Thank you very much for your help so far.
>
> seehttp://developer.android.com/guide/topics/providers/content-providers...
>
> 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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to