Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- StatFs stat = new StatFs(Environment.getDataDirectory().getPath());
- long totalSpace = stat.getBlockCountLong() * stat.getBlockSizeLong();
- long availableSpace = stat.getAvailableBlocksLong() * stat.getBlockSizeLong();
- long usedSpace = totalSpace - availableSpace;
- long usedSpaceInPercentage = (usedSpace * 100) / totalSpace;
- String message = "Espaço Usado: " + usedSpaceInPercentage + "%";
- Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement