1
3GBのRAMを搭載したLG G4またはNote 3でアプリを実行すると、デバイスに2GBのRAMが搭載されていることがわかります。誰かがどこに問題があるのか説明できるか?デバイスの合計RAMメモリを取得するには?
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();
}
:
はあなたに似た問題を抱えていました。 – duffymo
まあ、それは許可する必要があります、私は再びアンドロイドのドキュメントをチェックさせてください。 –
詳細は重要です。これは64ビットのJVMですか? 32ビットJVMから1.6GB以上を取得することはできません。http://www.oracle.com/technetwork/java/hotspotfaq-138619.html – duffymo