无法从下载的apk扩展文件中获取图像

时间:2012-12-05 06:53:28

标签: android

我已经添加了apk扩展文件并成功上传和dwonloaded,并且无法使用

访问它们

我的扩展文件包含图片,上传后我已完成拉链和上传...

下面是我从扩展文件中获取图像的代码......

任何人都可以帮助我..我怎样才能获得图像

ZipResourceFile expansionFile = APKExpansionSupport
                .getAPKExpansionZipFile(context, 1, 0);

// Get an input stream for a known file inside the expansion file
// ZIPs

InputStream is = expansionFile.getInputStream("95065668.jpg");
Log.d(TAG,
      "Assigning obb image to preview image::::::::::::"
            + is.available());
BitmapFactory.Options bfo = new BitmapFactory.Options();
bfo.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap b = BitmapFactory.decodeStream(is, null, bfo);

1 个答案:

答案 0 :(得分:1)

几乎已经完成了,请阅读您的HTML文件并将其转换为UTF-8字符串。 &安培;加载为

webview.loadData(ur_html_str, "text/html", null);

其中ur_html是这样的:

String ur_html_str = "<html><body>youe body contents</body></html>";