예제 #1
0
 private boolean checkFsWritable() {
   if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
     if (!ExpenseTrackerApplication.isInitialized) {
       ExpenseTrackerApplication.Initialize();
     }
   }
   return new File(Constants.DIRECTORY).canWrite();
 }
예제 #2
0
 private int calculatePicturesRemaining() {
   try {
     if (!hasStorage()) {
       return NO_STORAGE_ERROR;
     } else {
       if (!ExpenseTrackerApplication.isInitialized) {
         ExpenseTrackerApplication.Initialize();
       }
       StatFs stat = new StatFs(Constants.DIRECTORY);
       final int PICTURE_BYTES = 1500000;
       mPicturesRemaining =
           (int)
               (((float) stat.getAvailableBlocks() * (float) stat.getBlockSize()) / PICTURE_BYTES);
     }
   } catch (Exception ex) {
     mPicturesRemaining = CANNOT_STAT_ERROR;
   }
   return mPicturesRemaining;
 }