public class ResLoader { static void unpackResources() throws FileNotFoundException, IOException { final int BUFFER = 8192; android.content.res.Resources t = TestingE3d.mContext.getResources(); InputStream fis = t.openRawResource(R.raw.resources); if (fis == null) return; ZipInputStream zin = new ZipInputStream(new BufferedInputStream(fis, BUFFER)); ZipEntry entry; while ((entry = zin.getNextEntry()) != null) { int count; FileOutputStream fos = TestingE3d.mContext.openFileOutput(entry .getName(), 0); BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER); byte data[] = new byte[BUFFER]; while ((count = zin.read(data, 0, BUFFER)) != -1) { dest.write(data, 0, count);
R.raw.resources is a zip file - this class will unpack all the files in this zip file to your local folder. I use this for NDK.
you can access files from ndk through: / Data / data // files /
package = package where ResLoader is located filename = one of the files that is in raw / resources.zip
source share