In the raw folder, of our android project, have a test.zip file to decompress. The control class is the controller of my application.

import android.os.Environment;

import com.plasmik.test.Control;
import com.plasmik.test.R;

public void testRaw()
 {
 try{
 // output
 File sdcard = Environment.getExternalStorageDirectory();
 String subfolderSd = sdcard.getAbsolutePath() + "/" + Control.getPrefs().folderProject;
 File outputDir = new File (subfolderSd);

 // zip
 File f = new File(subfolderSd+"/test.zip");
 android.content.res.Resources t = Control.getContext().getResources();
 InputStream fis = t.openRawResource(R.raw.test);
 Utils.inputstreamToFile(fis, f);

 ZipHelper.unzip(f, outputDir);
 }
 catch (Exception e) {
 Log.d("control","unzip error: "+e);
 }
 }

Seguir leyendo