excellent, thanks so much
On Jul 3, 2:56 am, gjs <[email protected]> wrote:
> Hi,
>
> See android.os.StatFs
>
> The camera source code has an example of use
>
> http://android.git.kernel.org/?p=platform/packages/apps/Camera.git;a=...
>
> eg:
>
> public static int calculatePicturesRemaining() {
> 733 try {
> 734 if (!ImageManager.hasStorage()) {
> 735 return NO_STORAGE_ERROR;
> 736 } else {
> 737 String storageDirectory =
> Environment.getExternalStorageDirectory().toString();
> 738 StatFs stat = new StatFs(storageDirectory);
> 739 float remaining = ((float)stat.getAvailableBlocks
> () * (float)stat.getBlockSize()) / 400000F;
> 740 return (int)remaining;
> 741 }
> 742 } catch (Exception ex) {
> 743 // if we can't stat the filesystem then we don't know
> how many
> 744 // pictures are remaining. it might be zero but just
> leave it
> 745 // blank since we really don't know.
> 746 return CANNOT_STAT_ERROR;
> 747 }
> 748 }
>
> Regards
>
> On Jul 3, 7:22 am,Chris<[email protected]> wrote:
>
> > This is quite a simple question, but I haven't yet been able to find a
> > solution. How would one determine the number of bytes that are not
> > used on the file system (both the main and the SD card) within an
> > application? I'm writing an application that downloads content from
> > the internet, and I'd rather not fill up my users' phones without at
> > least giving them fair warning when their file system is about to fill
> > up. Thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---