26
My application is downloading zip file from the server and extract this zip file and save files into sd card but problem is if i am downloading 4-5 MB zip files and extract it, this is working good but if i am downloading 30-35 MB zip file this will give me error, sorry for my bad English communication.
The Below is my Code for Download & Unzip Zip File:-
public class UnzipManager {
private static String BASE_FOLDER;
public static Context localContext;
public static String passurl;
public static int count;
public static Context context;
/*
* You can use this flag to check whether Unzippingthread is still running..
*/
public static boolean isDownloadInProgress;
/*
* After unzipping using this flag ,you can check whether any low memory
* exceptions Occurred or not..and alert user accordingly..
*/
public static boolean isLowOnMemory;
public static int i = 0;
public static ZipEntry zipEntry;
public static void startUnzipping(Context ctx, int c, String url) {
context = ctx;
count = c;
/*
* MAKE SURE THAT localContext VARIABLE HAS BEEN INITIALIZED BEFORE
* INVOKING THIS METHOD.
*
* ALSO MAKE SURE YOU HAVE SET "INTERNET" AND "NETWORK ACCESS STATE"
* PERMISSIONS IN APPLICATION'S MANIFEST FILE.
*/
Log.d("DEBUG", "In startUnzipping()");
UnzipManager.BASE_FOLDER = Environment.getExternalStorageDirectory()
+ File.separator + "samples";
/*
*
*/
Log.d("DEBUG", "BASE_FOLDER:" + UnzipManager.BASE_FOLDER);
UnzipManager.isLowOnMemory = false;
// Start unzipping in a thread..which is safer
// way to do high cost processes..
passurl = url;
new UnzipThread().start();
}
private static class UnzipThread extends Thread {
@Override
public void run() {
UnzipManager.is