get CPU Information - Android android.os

Android examples for android.os:CPU

Description

get CPU Information

Demo Code

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class Main {

  @SuppressWarnings("resource")
  private static String getCPUInfos() {
    String str1 = "/proc/cpuinfo";
    String str2 = "";
    StringBuilder resusl = new StringBuilder();
    String resualStr = null;// ww w.j  a  va  2  s  .  com
    try {
      FileReader fr = new FileReader(str1);
      BufferedReader localBufferedReader = new BufferedReader(fr, 8192);
      while ((str2 = localBufferedReader.readLine()) != null) {
        resusl.append(str2);
        // String cup = str2;
      }
      if (resusl != null) {
        resualStr = resusl.toString();
        return resualStr;
      }
    } catch (IOException e) {
    }
    return resualStr;
  }

}

Related Tutorials