android 判断网络连接如果没有网络 就打开网络设置
Intent mIntent = new Intent("/");
ComponentName comp = new ComponentName("com.android.settings", "com.android.settings.WirelessSettings");
mIntent.setComponent(comp);
mIntent.setAction("android.intent.action.VIEW");
startActivity(mIntent);
但是这方法在4.0没用,4.0废弃了这方法。
startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));这方法安卓目测所有版本应该都支持。
今天还遇到了一个比较纠结的问题,就是在js和webview交互中传一个电话号码,2.2正常接收js传过来的电话号码,但是android 4.0版本中接收到的值不同,仔细看4.0接收到的值发现那个电话号码被自动转化为科学计数法了,在js中
var s1 = String(a);可以调整错误。
至于为什么js传电话号码在什么时候转化了电话号码不清除,估计是android2.2,android对于11位数的处理方式不同造成的。