我要重新啓動我的手機,我試圖重新啓動Android設備的onClick按鈕
try {
Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "reboot" });
proc.waitFor();
} catch (Exception ex) {
Log.i(TAG, "Could not reboot", ex);
}
也PowerManager的看到我的編碼,但設備沒有在這兩個編碼重啓好心給工作代碼
ok = (Button)findViewById(R.id.button1);
final PowerManager power = (PowerManager)getSystemService(Context.POWER_SERVICE);
ok.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
power.reboot("fav");
}
});
http://stackoverflow.com/questions/3745523/programmatically-switching-off-android-phone – 2012-02-13 09:20:09
我試過這個沒有結果 – 2012-02-13 09:21:28