Reputation: 43
I want to learn my phone cpu model name and I tryed to use /proc/cpuinfo and a lot of code but I failed. Can anyone help me?
Upvotes: 4
Views: 3960
Reputation: 21
Here is my code
public static String getCpuName() {
try {
FileReader fr = new FileReader("/proc/cpuinfo");
BufferedReader br = new BufferedReader(fr);
String text = br.readLine();
br.close();
String[] array = text.split(":\\s+", 2);
if (array.length >= 2) {
return array[1];
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
What about your code?
Upvotes: 1