I want to get full RAM size of a device. memoryInfo.getTotalPss()
returns 0. There is not function for get total RAM size in ActivityManager.MemoryInfo
.
How to do this?
Here's how: Press Ctrl + Shift + Esc to launch Task Manager. Or, right-click the Taskbar and select Task Manager. Select the Performance tab to see current RAM usage displayed in the Memory box, and total RAM capacity listed under Physical Memory.
Press the Windows key , type Properties, and then press Enter . In the System Properties window, the Installed memory (RAM) entry displays the total amount of RAM installed in the computer. For example, in the picture below, there is 4 GB of memory installed in the computer.
Right click the My Computer icon on the Windows Desktop. Select Properties. The amount of RAM is displayed next to the CPU speed.
Open Start. Search for Command Prompt, right-click the top result, and select the Run as administrator option. Type the following command to determine the total amount of RAM installed on the computer and press Enter: wmic computersystem get totalphysicalmemory.
As of API level 16 you can now use the totalMem
property of the MemoryInfo
class.
Like this:
ActivityManager actManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo(); actManager.getMemoryInfo(memInfo); long totalMemory = memInfo.totalMem;
Api level 15 and lower still requires to use the unix command as shown in cweiske's answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With