Scratch this. I got it working by using a URI (all caps) URI fileUri = URI.create(filePath); to create the file. The blank web view content was because the unzipped files were empty.
On Dec 6, 10:01 am, tatebn <[email protected]> wrote: > I'm trying to load internal content in an android web view. The > content is in a content directory that's been unzipped into the app's > files directory. I can verify that the files are there by using the > adb shell. However I keep getting an error in the web view that the > file doesn't exist. I'm using a content provider for to load this. > It's registered correctly and being called. And the file path it > prints out is the same as the file path in the adb shell. > > public class InternalContentProvider extends ContentProvider{ > > private static final String TAG = "InternalContentProvider"; > > @Override > public ParcelFileDescriptor openFile(Uri uri, String mode) throws > FileNotFoundException{ > String filePath = "file://" + this.getContext().getFilesDir() > + "/content" + uri.getPath(); > File file = new File(filePath); > > Log.i(TAG, "File uri = " + filePath); > Log.i(TAG, "File name = " + file.getName()); > > ParcelFileDescriptor parcel = ParcelFileDescriptor.open(file, > ParcelFileDescriptor.MODE_READ_ONLY); > return parcel; > } > > @Override > public boolean onCreate() { > System.out.println("Created ContentProvider"); > return true; > } > > @Override > public int delete(Uri uri, String s, String[] as) { > throw new UnsupportedOperationException("Not supported by this > provider"); > } > > @Override > public String getType(Uri uri) { > return "text/html"; > } > > @Override > public Uri insert(Uri uri, ContentValues contentvalues) { > throw new UnsupportedOperationException("Not supported by this > provider"); > } > > @Override > public Cursor query(Uri uri, String[] as, String s, String[] as1, > String s1) { > throw new UnsupportedOperationException("Not supported by this > provider"); > } > > @Override > public int update(Uri uri, ContentValues contentvalues, String s, > String[] as) { > throw new UnsupportedOperationException("Not supported by this > provider"); > } > > } > > I'm doing this in the android emulator. API level is 8. -- 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

