没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
ShutdownThread.shutdown(mContext, true );
代码中ShutdownThread.reboot()方法有三个参数其中第二个参数是一个String,如果这个String是NULL的话,就是正常重启,如果是recovery,系统重启进入recovery mode。
====================================================================
刚才想怎么把手机重启实现了,结果google以android reboot搜索,竟然没有结果,可能是关键字有问题。只好换百度,还好,有答案了。以下是几种解决方案:
第一种是调用shell里面的reboot命令。
public class RebootAndroid extends Activity implements OnClickListener {
private Button btnReboot;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btnReboot = (Button) findViewById(R.id.btnReboot);
btnReboot.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String cmd = "su -c reboot";
try {
Runtime.getRuntime().exec(cmd);
} catch (IOException e) {
// TODO Auto-generated catch block
new AlertDialog.Builder(this).setTitle("Error").setMessage(
代码中ShutdownThread.reboot()方法有三个参数其中第二个参数是一个String,如果这个String是NULL的话,就是正常重启,如果是recovery,系统重启进入recovery mode。
====================================================================
刚才想怎么把手机重启实现了,结果google以android reboot搜索,竟然没有结果,可能是关键字有问题。只好换百度,还好,有答案了。以下是几种解决方案:
第一种是调用shell里面的reboot命令。
public class RebootAndroid extends Activity implements OnClickListener {
private Button btnReboot;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btnReboot = (Button) findViewById(R.id.btnReboot);
btnReboot.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String cmd = "su -c reboot";
try {
Runtime.getRuntime().exec(cmd);
} catch (IOException e) {
// TODO Auto-generated catch block
new AlertDialog.Builder(this).setTitle("Error").setMessage(
mangyuan1225
- 粉丝: 2
- 资源: 63
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
前往页