android 4.0如何打开无线设置界面
来源:互联网 发布:淘宝和快递合作多少钱 编辑:程序博客网 时间:2024/05/02 02:29
在android4.0之前可以通过下面方法打开无线网络设置页面,可是在4.0以上则会抛异常
Intent mIntent = new Intent("/");
ComponentName comp = new ComponentName(
"com.android.settings",
"com.android.settings.WirelessSettings");
mIntent.setComponent(comp);
mIntent.setAction("android.intent.action.VIEW");
startActivityForResult(mIntent, 0);
那么有什么方法进行兼容吗?
经过尝试采用下面的方法startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));可以兼容4.0之前及之后的版本,不过由于android3.0之后设置界面改动很大,所以个人采用下面的方法打开网络设置
if(android.os.Build.VERSION.SDK_INT > 10 ){
//3.0以上打开设置界面
context.startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS));
}else
{
context.startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));
}
Intent mIntent = new Intent("/");
ComponentName comp = new ComponentName(
"com.android.settings",
"com.android.settings.WirelessSettings");
mIntent.setComponent(comp);
mIntent.setAction("android.intent.action.VIEW");
startActivityForResult(mIntent, 0);
那么有什么方法进行兼容吗?
经过尝试采用下面的方法startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));可以兼容4.0之前及之后的版本,不过由于android3.0之后设置界面改动很大,所以个人采用下面的方法打开网络设置
if(android.os.Build.VERSION.SDK_INT > 10 ){
//3.0以上打开设置界面
context.startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS));
}else
{
context.startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));
}
- android 4.0如何打开无线设置界面
- android 4.0如何打开无线设置界面?
- Android打开设置界面
- Android 4.0 打开网络设置界面
- android如何打开系统wifi、蓝牙等设置界面
- 如何在android的开发中打开系统设置界面
- android如何打开系统wifi、蓝牙等设置界面
- Android打开系统设置界面
- Android打开系统设置界面
- Android打开系统设置界面
- Android打开系统设置界面
- Android打开系统设置界面
- Android打开系统设置界面
- Android 打开系统设置界面
- Android打开系统设置界面
- Android打开系统设置界面
- Android打开系统设置界面
- Android打开系统设置界面
- 学习bisect模块保持列表排序
- 状态机的两种写法
- busmouse.h 头文件分析 \linux-1.0\linux\include\linux\busmouse.h
- EntityManager的find()与getReference()的区别
- 折线分割平面 hdu2050 递推
- android 4.0如何打开无线设置界面
- could not find the main class. program will exit问题的解决方法
- 图像工作回顾之一:运动分析
- TLD取经之路(5)-- 此处省略XX字
- linux释放垃圾内存
- linux下搭建ipv6测试环境
- 详解android Handler使用
- linux下ffmpeg操作(原创)
- [Unity3D]如何使用脚本模拟出跳跃的效果