1

I was wondering how I can get the information about any memory card, internal storage that an android device have! what I want is the free, used memory amount and if possible the extra details about memory card! ( not the internal Storage )

Imesh Chandrasiri
  • 5,558
  • 15
  • 60
  • 103
  • 2
    http://stackoverflow.com/questions/2941552/android-sd-card-free-space – Ran Jul 10 '12 at 09:39
  • refer this to http://stackoverflow.com/questions/8133417/android-get-free-size-of-internal-external-memory – Aerrow Jul 10 '12 at 09:46

1 Answers1

1

This will help you to get free memory of external storage:

StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath());
long bytesAvailable = (long)stat.getBlockSize() * (long)stat.getAvailableBlocks();
long megAvailable = bytesAvailable / (1024 * 1024);
Log.d("","Available MB : "+megAvailable);

Hope this will help you.

AkashG
  • 7,868
  • 3
  • 28
  • 43
  • 1
    You can also read-http://saga-androidapplication.blogspot.in/2011/09/phone-internal-and-external-storage.html – AkashG Jul 10 '12 at 09:46
  • I have posted the above code as i have done it before.and you can compare the code its not the pretty same. – AkashG Jul 10 '12 at 09:48
  • 1
    as if already correct answer is given by some one, is it required to repeat the same. – Daud Arfin Jul 10 '12 at 09:50
  • that was not my intension,i also posted the link through which i implemented the same think a couple of weeks before. – AkashG Jul 10 '12 at 09:52