How to get the currently available RAM in an Android device
•
Android
See the English answer > how to get current memory usage in Android? 9 devices in which we enter the management application – > Run tab, and then at the bottom we will see used memory and amplifiers. Free memory changes their value
How do we code it into my application to display the same statistics?
thank you
resolvent:
ActivityManager.MemoryInfo
MemoryInfo mi = new MemoryInfo();
ActivityManager activityManager = (ActivityManager)getActivity(). getSystemService(Context.ACTIVITY_SERVICE);
activityManager.getMemoryInfo(mi);
long availableMegs = mi.availMem / 1048576L;
long percentAvail = mi.availMem / mi.totalMem;
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码