安卓开发,想获取硬件设备中的CPU名称。用Build类获取的并不完全正确,但是/proc/cpuinfo文件下的格式不固定。怎么才能获取到CPU名
用下面这样的不行吗?
private static String getCpuName(){
try{
FileReader fr = new FileReader("/proc/cpuinfo");
BufferedReader br = new BufferedReader(fr);
String text = br.readLine();
String[] array = text.split(":\s+",2);
for(int i = 0; i < array.length; i++){
}
return array[1];
}catch(FileNotFoundExecption e){
e.printStackTrace();
}catch (IOException e){
e.printStackTrace();
}
return null;
}