在Android 修改系统时间的方式挺麻烦的 好像需要获取最高权限 但是往往不可能每个用户都会Root手机 所以这点挺让人费解
最近整理了个修改系统时间的方法 但是还要Root权限 有点无语
try {
Date d = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse(timeStr);
String date = new SimpleDateFormat("yyyyMMdd.hhmmss").format(d);
Process process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(
process.getOutputStream());
os.writeBytes("date -s " + date + "; \n");
} catch (Exception e) {
Log.d("error", "error==" + e.toString());
e.printStackTrace();
}