Get unused memory size - Android Hardware

Android examples for Hardware:Memory

Description

Get unused memory size

Demo Code


//package com.java2s;

import android.app.ActivityManager;

import android.content.Context;

public class Main {
    public static long getmem_UNUSED(Context mContext) {
        long MEM_UNUSED;
        ActivityManager am = (ActivityManager) mContext
                .getSystemService(Context.ACTIVITY_SERVICE);
        ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
        am.getMemoryInfo(mi);//  www .j  ava 2  s  . com
        MEM_UNUSED = mi.availMem / 1024;
        return MEM_UNUSED;
    }
}

Related Tutorials