Answer the question
In order to leave comments, you need to log in
Java. Android. Writing content provider for WebView?
To load images in a WebView , a custom content provider was written that, by overriding the openFile method , must return a byte stream of binary image content.
However, there was the next snag. openFile returns a ParcelFileDescriptor , which can be obtained by calling
ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
byte[] imageData = ...;
Parcel parcel = Parcel.obtain();
parcel.writeByteArray(imageData, 0, imageData.length);
return parcel.getFileDescriptor();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question