Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.app.Activity;
import android.app.ActivityManager;

public class Main {
    public static int getRamFree(Activity mActivity) {
        ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
        ActivityManager activityManager = (ActivityManager) mActivity.getSystemService(Activity.ACTIVITY_SERVICE);
        activityManager.getMemoryInfo(mi);

        int free = (int) (mi.availMem / 1048576L);
        return free;
    }
}