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 + "%";
- TextView textView = findViewById(R.id.text_view); // suponha que você tenha um TextView com esse ID no seu layout
- textView.setText(message);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement