Android examples for Hardware:Memory
get Ram Size from /proc/meminfo
//package com.java2s; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import android.content.Context; public class Main { public static int getRamSize(Context context) { BufferedReader br = null; try {//w ww .ja v a2 s. c om FileReader fr = new FileReader("/proc/meminfo"); br = new BufferedReader(fr); String line = br.readLine(); String[] arrayOfString = line.split("\\s+"); return Integer.valueOf(arrayOfString[1]).intValue() / 1024; } catch (IOException e) { } finally { if (br != null) { try { br.close(); } catch (IOException e) { } } } return -1; } }