Thankyou, I used the image content provider first which loaded a
question mark as a picture but proved unstable.

I finally found the function I was looking for in case anyone else has
the same problem, although I have to warn you it does the exact thing
Google was trying to prevent. (Gives the browser access to the file
system again which can have security implications.)

    public android.os.ParcelFileDescriptor openFile(android.net.Uri
uri, java.lang.String mode) throws java.io.FileNotFoundException{
        ParcelFileDescriptor parcel;
        Log.v(TAG, "file requested ["+uri.toString()+"]");

        String root_uri = NotePad.CONTENT_URI.toString();
        String root_folder = "file:///data/data/
com.example.android.notepad/files";

        String request_uri = uri.toString().substring(root_uri.length());
        String request_file = root_folder.concat(request_uri);

        Log.v(TAG, request_file);

        URI uri2 = URI.create(request_file);
        File file = new File(uri2);
        Log.v(TAG, "LENGTH "+file.length());
        parcel = ParcelFileDescriptor.open(file,
ParcelFileDescriptor.MODE_READ_ONLY);
        return parcel;
    }

I overlooked "public ParcelFileDescriptor openFile" while searching
before in the content provider api, and still couldn't find
tutorials..  but the above code should serve any files within the apps
files folder to the browser the rest of the code for the
contentProvider doesn't seem necessary when surving files which is a
little confusing.

On Sep 27, 7:21 pm, Nickname <[EMAIL PROTECTED]> wrote:
> Yes, you can.
>
> You can use the content:// url returned by photo picker activity.
>
> On Sep 26, 1:49 pm, Martrinex <[EMAIL PROTECTED]> wrote:
>
> > I want to be able to access local files from webview. Most tutorials I
> > see use "file://" which I believe has been blocked on v.9+ I tried to
> > use the notepad content provider in tests to load plain text via
> > loadurl but just get page not found.
>
> > Can I display <img> with src="content://"
> > Can I load pages directly using loadurl("content://");
> > Are there any examples in creating a content provider (or editing the
> > notepad one) to serve web content (locally) to my apps?
>
> > I hope I am on the right track, and you guys can point me in the
> > correct direction. Thanks.
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to