Currently I am facing a very crucial problem. In my application I need to extract one zip file (always > 20 MB) into SD Card - along with the other tasks like copying the database, deleting other unnecessary files etc. But all this stuffs will be done only once - on first run of my application. Everything was working fine until client gave me a requirement to put this zip in assets folder. Now my application is getting force closed.
here is the problem and my attempts.
1. First I tried to open the file from assets by using
But I get NullpointerException on this line. On the other hand I am copying my database using this way only. I think this is because of the very large size of the file.
2. So I did another attempt to copy this file into SD Card before unzipping it. So I used following code.
By doing this my zip is getting copied successfully but after that another action I am performing. That action is - to get the image file name from DB and take the image from the Unzipped folder (after unzipping this file) at that time I am getting
bitmap size exceeds VM budget while on decodeStream exception while decoding stream. But this comes only once - I mean immediately after unzipping. After restarting the app this whole process is not getting repeated so only thing comes in picture is to get the image from sd card and set it. So it works fine.
And if I comment the above code (to copy file) and already put one zip in asset (for testing) then works fine. That means this code occupies more resources.
3. Then I tried to copy file using IOUtils. But for that also I need to open that zip to make the InputStream -
So again null pointer exception I am getting.
The situation seems like dead lock to me.
So what should I do to unzip this file. Please suggest me if you are getting my problem.