我最近 2 天面临一个问题,我们如何在 Google Play 上上传大小超过 50Mb 的 .apk 文件,然后我找到了一种从链接上传带有 APK 扩展文件的 .apk 文件的方法http://developer.android.com/guide/market/expansion-files.html http://developer.android.com/guide/market/expansion-files.html现在我最终成功了,但现在我遇到了问题,如何从我的对象中的主扩展文件中读取文件,就像它是 .obb 格式一样
但现在可以使用主扩展文件中的 .mp3 文件,例如:
AssetFileDescripto assetFileDescriptor = zipResourceFile.getAssetFileDescriptor(
"assets/all_types_of_people1.mp3");
mediaPlayer = new MediaPlayer();
mediaPlayer.setDataSource( assetFileDescriptor.getFileDescriptor(),
assetFileDescriptor.getStartOffset(),assetFileDescriptor.getLength());
但是我们如何使用主扩展文件中的图像到WebView呢?
由于可以从 zipResourceFile 获取流,因此可以使用 BitmapFactory 从它们创建图像。
InputStream is = zipResourceFile.getInputStream("myFilePath.jpg");
BitmapFactory.Options bfo = new BitmapFactory.Options();
bfo.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap b = BitmapFactory.decodeStream(is, null, bfo);
请注意,由于解码需要一些时间,因此您需要在 UI 线程之外执行此操作。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)