@Override
public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
try {
String path = uri.getPath();
int off = path.indexOf('/', 1);
if (off < 0 || off >= (path.length()-1)) {
throw new FileNotFoundException("Unable to open " + uri);
}
int cookie = Integer.parseInt(path.substring(1, off));
String assetPath = path.substring(off+1);
AssetFileDescriptor asset = getContext().getAssets().openNonAssetFd(cookie, assetPath);
return new ParcelFileDescriptor(openPipeHelper(uri, null, null,
asset.createInputStream(), this));
} catch (IOException e) {
FileNotFoundException fnf = new FileNotFoundException("Unable to open " + uri);
throw fnf;
}
}