Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8113929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:59:18+00:00 2026-06-06T02:59:18+00:00

Here is my requirement. I need to unzip a zip file and store it

  • 0

Here is my requirement. I need to unzip a zip file and store it in sdcard. I have now unzipped the file and stored in the sdcard by making use of the example provided here.And its working fine. Now before saving the file to sdcard I need to find out whether there is available space in sdcard so that I can extract my zip file without any problem. I found out this example helpful in finding out the size of a folder in sdcard. So I used this to find out the size of the unzipped files.

But here is my problem. As we know , when extracting a zip, we might need a little extra space to save the files, since unzipped file will not be of the same size as the zip file itself and it will require more space. Here goes my questions.

  1. How to find the available space in SDCard?
  2. Is there any way to identify the total space that would be required by the unzipped files even before unzipping it, so that i can inform the user if the available space in SD Card is not enough?

Any help is much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T02:59:20+00:00Added an answer on June 6, 2026 at 2:59 am

    You can iterate the ZipEntry‘s in your file, call getSize() on each and add this up to get an approximation. This is not always guaranteed to be available though (it may return -1). Add to this the size of the actual zip file, and probably round up to the megabyte to be sure. You can use something like this to get the available free space on external storage:

    StatFs stats = new StatFs(Environment.getExternalStorageDirectory().getAbsolutePath());
    long free = ((long) stats.getBlockSize()) * stats.getAvailableBlocks();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a weird requirement which I need to use inside my Stored Procedure
Here I have 2 requirements: Need a batch file to start a process on
I need your suggestions in solving this issue. Here is the requirement. We have
I have a textbox with calendar button. Here my requirement is I need to
I have a very weird requirement where I need to deal with months. Here
I have a very similar requirement specified here . I need to have the
Here is simplified version of my requirement I have a java class say Processor
All,In my requirement need to send a mail with attached text file, which is
I have a requirement where I need to check DB/@dbtype == 'oracle' (case insensitive).
Here is the requirement: Anonymous Users need to enter some info into InfoPath on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.