1

I have gone through the forums and got a method to get the android processor information as a string! well, it returns lots of information that is irrelevant to a user. I want to get the specific details only like

Processor Name or type Avilabale cores Cache size Processor Version

this is the method I found to get the information! if any one can tell me a way to get specific details please help me! :)

   private String getInfo() {
    StringBuffer sb = new StringBuffer();
    sb.append("abi: ").append(Build.CPU_ABI).append("\n");
    if (new File("/proc/cpuinfo").exists()) {
        try {
            BufferedReader br = new BufferedReader(new FileReader(new  File("/proc/cpuinfo")));
            String aLine;
            while ((aLine = br.readLine()) != null) {
                sb.append(aLine + "\n");
            }
            if (br != null) {
                br.close();
            }
        } catch (IOException e) {
            e.printStackTrace();
        } 
    }
    return sb.toString();
    }

and I'm kinda new to android app development so please help me in this! :) ( MY research project )

Imesh Chandrasiri
  • 5,558
  • 15
  • 60
  • 103

1 Answers1

1

I'm getting the Processor namefrom the available details. You can change what you want.

while ((aLine = br.readLine()) != null) {
                    if(aLine.contains("Processor"))
                    {
               String pro=aLine;
               Log.v("Processor>>>",pro);
                    }
                    sb.append(aLine + "\n");
                }
Manikandan
  • 1,479
  • 6
  • 48
  • 89