How to get Total RAM memory of the Device?
<p>When i run my app on LG G4 or Note 3 which has 3GB of RAM, it shows that the device has 2GB of ram. Can someone explain where is the problem? </p>

<pre><code>    ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
    ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
    activityManager.getMemoryInfo(mi);
    long freeMemory = mi.availMem / 1048576L;
    long totalMemory = mi.totalMem / 1048576L;
    long usedMemory = totalMemory - freeMemory;
    SharedPreferences sharedPreferences = getApplicationContext().getSharedPreferences(Util.MyPREFERENCES, 0);
    String status = sharedPreferences.getString(Util.KEY_STATUS, null);
    if (status.equals("clean")) {
        tvFree.setText(freeMemory + " MB");
        tvTotal.setText(totalMemory + " MB");
        tvUsed.setText(usedMemory + " MB");
        stateImage.setImageResource(R.drawable.greenstate);
        rippleBackground.stopRippleAnimation();
    }
</code></pre>