/**
* 获取当前可用内存大小
*
* @return
*/
private String getAvailMemory()
{
ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
MemoryInfo mi = new MemoryInfo();
am.getMemoryInfo(mi);
return Formatter.formatFileSize(getBaseContext(), mi.availMem);
}
/**
* 获取手机CPU信息
*
* @return
*/
public String[] getCpuInfo()
{
String str1 = "/proc/cpuinfo";
String str2 = "";
String[] cpuInfo = { "", "" };
String[] arrayOfString;
try
{
FileReader fr = new FileReader(str1);
BufferedReader localBufferedReader = new BufferedReader(fr, 8192);
str2 = localBufferedReader.readLine();
arrayOfString = str2.split("\\s+");
for (int i = 2; i < arrayOfString.length; i++)
{
cpuInfo[0] = cpuInfo[0] + arrayOfString[i] + " ";
}
str2 = localBufferedReader.readLine();
arrayOfString = str2.split("\\s+");
cpuInfo[1] += arrayOfString[2];
localBufferedReader.close();
}
catch (IOException e)
{
}
tvHardwareInfo.append("CPU型号 " + cpuInfo[0] + "\n" + "CPU频率: " + cpuInfo[1] + "\n");
return cpuInfo;
}