Why must WebView display local files via a ContentProvider?

by Biosopher » Thu, 06 Nov 2008 02:02:54 GMT

Sponsored Links
 In case you hadn't heard, WebView won't display local files directly
via loadUrl("file://YOUR_PATH/file.html).  All the solutions create a
ContentProvider to access the local files and send them to a WebView
using ContentProvider.openFile().

This approach seems less secure than simply sending my locally created
application files files directly to WebView.  My app creates and
stores the files in my sandboxed local file directory so they should
be inaccessible to anyone and thus secure.

I know the standard response for why this is:  "That WebView's access
to local files would be insecure".

But why is it safer to wrap files into a ContentProvider and then feed
them to WebView when the purpose of a ContentProviders is mostly to
share content between apps.. .which I won't be doing?

So my questions:
1) What was wrong with the local file solution for WebView.loadUrl().
2) Why is it safer to wrap my local files into a ContentProvider?


Other Threads

1. Good EULA idea

I know that users of apps even paid one hate to click through a EULA.  
Some of the developers think they're important.  To pop one up even on 
first run using the example code is actually tricky and sloppy in some 
cases.  I do that but I'm going to remove them.  The free apps I've 
downloaded to the phone so far don't even have EULAs.   And today I 
download the free Adobe Photoshop.  In their description they say by 
downloading the app you are agreeing to the EULA and provide the web 
link for it.  If that works for Adobe it should work for anyone else.  

Brian Conrad


2. How to change application theme at runtime

According to the Dev Guide this is not possible.  Changing the theme
requires your app to be restarted.

There are only 10 types of people in the world...
Those who know binary and those who don't.


3. Installing custom built SDK

4. Android - NPE in BrowserFrame

5. Great Idea in need of better JAVA pro

6. Motorola Android Improvements

7. Communication between AppWidgetProvider and Configuration Activity