Android calculates the percentage of memory used currently. android percentage
Some Mobile Phone Manager software can display the percentage of memory used by the current system. This number is calculated by the ratio of the total memory size, the available memory size, and the total memory size, the following code calculates the memory usage.
/*** Calculate the percentage of memory in use **/public static String getUsedPercentValue (Context context) {String dir = "/proc/meminfo "; try {FileReader fr = new FileReader (dir); BufferedReader br = new BufferedReader (fr, 2048); String memoryLine = br. readLine (); String subMemoryLine = memoryLine. substring (memoryLine. indexOf ("MemTotal:"); br. close (); long totalMemorySize = Integer. parseInt (subMemoryLine. replaceAll ("\ D +", ""); l Ong availableSize = getAvailableMemory (context)/1024; int percent = (int) (totalMemorySize-availableSize)/(float) totalMemorySize * 100); return percent + "% ";} catch (IOException e) {e. printStackTrace ();} return "no result";}/*** get the current available memory. The returned data is in bytes. * @ Return the current available memory. */Private static long getAvailableMemory (Context context) {ActivityManager. MemoryInfo mi = new ActivityManager. MemoryInfo (); getActivityManager (context). getMemoryInfo (mi); return mi. availMem ;}
Android smart phone memory usage is normal
Generally, the mobile phone is between 50 and 90%. It depends on how much memory and software is running on your mobile phone. 75 is normal, not much, but most mobile phone memory is 512 MB.
My mobile phone is Android, and the running memory is 236 mb. The percentage of memory running when the software is not running on the phone is more than 60%.
Some software is automatically started upon startup, for example, the input method is used for storage. After the boot, you use 360 to clean up the system and check whether there are many built-in things and people on Android phones that haven't been flushed. and so on.