android 获取 可用内存

android 获取 可用内存 java代码

        Runtime runtime = Runtime.getRuntime();
        long usedMemory = runtime.totalMemory() - runtime.freeMemory();
        long usedMemoryInMB = usedMemory / (1024 * 1024);

        Log.d("MyApp", "totalMemory "+runtime.totalMemory()+ " Used memory: " + Long.toString(usedMemoryInMB)+" freeMemory"+runtime.freeMemory());

你可能感兴趣的:(android开发,开发语言)