-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 8/6/10 18:21 , TreKing wrote:
> On Fri, Aug 6, 2010 at 8:23 AM, pradeep <[email protected]
> <mailto:[email protected]>> wrote:
>
>     Could you please let me know if there is any API to check
>     whether inserted SD Card is full . If it has free space, then
>     how to know how much free space is left.
>
>
> The SD card is a Java File like any other. Knowing this, doing this
> http://tinyurl.com/2cmrt59  led me to
>
> http://download.oracle.com/javase/6/docs/api/java/io/File.html#getTotalSpace()
>
> and
>
> http://download.oracle.com/javase/6/docs/api/java/io/File.html#getFreeSpace()
>
> Try that.
>
I do this:

        statFs = new
StatFs(getExternalStorageDirectory().getAbsolutePath());
        return statFs.getAvailableBlocks() * statFs.getBlockSize();

Seems to work, with a user that once said that he experienced a
problem that could be tracked down to that value erroneously computed
as zero (or a very small value) even if the card was ok. But I had no
more feedback from him and no other notices of error.

- -- 
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
java.net/blog/fabriziogiudici - www.tidalwave.it/people
[email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxcRcgACgkQeDweFqgUGxfcmgCgsQtqykvLuCZrPEBxjo18t6RW
gzAAn0xfWkvqp5N3JanzrbdYIMknQSAI
=fNGB
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to