首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 其他相关 >

读写系统设立——日期与时间使用网络提供的值(时间与网络同步)

2012-10-06 
读写系统设置——日期与时间使用网络提供的值(时间与网络同步)//读_1.带默认参数的Settings.System.getInt(g

读写系统设置——日期与时间使用网络提供的值(时间与网络同步)

 //读_1.带默认参数的Settings.System.getInt(getContentResolver(), Settings.System.AUTO_TIME, 0);        //读_2.不带默认参数的需要捕捉异常try {     Settings.System.getInt(getContentResolver(),  Settings.System.AUTO_TIME);        } catch (SettingNotFoundException e) {            e.printStackTrace();        }//设置Settings.System.putInt(getContentResolver(),Settings.System.AUTO_TIME, 0);//但是切记:改写Seting的值必须要在AndroidManifest.xml中添加权限: <uses-permission android:name = "android.permission.WRITE_SETTINGS"/>  

热点排行