private String ReadCPUMhz()
{
ProcessBuilder cmd;
String result="";
int resultshow = 0;
try{
String[] args = {"/system/bin/cat", "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"};
cmd = new ProcessBuilder(args);
Process process = cmd.start();
InputStream in = process.getInputStream();
byte[] re = new byte[1024];
while(in.read(re) != -1)
{
result = result + new String(re);
}
in.close();
} catch(IOException ex){
ex.printStackTrace();
}
return result;
}
I used setText to write the value from result to a textView. So it read out the current cpu frequency when app was started and write it to this textView. The app shows f.e. 1200Mhz the whole time the app is opened. It didn't update the value.
How can I use Timer or other methods to update the current value after 1s or 250ms and write it to the textView? It should display the current CPU frequency. F.e.: 300Mhz - 1200Mhz.. updating after 1s or 250ms..
Please help me :-)
Best regards
Marcus