private boolean checkFsWritable() { if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { if (!ExpenseTrackerApplication.isInitialized) { ExpenseTrackerApplication.Initialize(); } } return new File(Constants.DIRECTORY).canWrite(); }
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; }