i can display the size of a app package in MB but i have too much decimal numbers..
ApplicationInfo appInfo = packageInfo.applicationInfo;
try{
File file = new File(appInfo.sourceDir);
double sizeInBytes = file.length(); // size in Byte
double sizeInMb = sizeInBytes / (1024 * 1024);
physicalsize.setText(""+sizeInMb);
} catch( Exception e ) {
//e.printStackTrace();
}
How can i have only 2 decimals like:
4.3 MB instead 4.35652148952
?