我应该如何编程打开三星设备的飞行模式设置页面? [英] How should I programmatically open the Flight Mode setting page on Samsung devices?
本文介绍了我应该如何编程打开三星设备的飞行模式设置页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我与开口下方code中的飞行模式设置页面。
startActivity(新意图(Settings.ACTION_AIRPLANE_MODE_SETTINGS));
这是对大多数设备的正常工作。但在三星型号= GT-19300它抛出一个异常:
ActivityNot找到Exception.No活动中来处理意图
{android.Settings.ACTION_AIRPLANE_MODE_SETTINGS}
块引用>什么是意图字符串三星设备打开飞行模式设置?
解决方案如果(android.os.Build.VERSION.SDK_INT< 17){
尝试{
意图intentAirplaneMode =新意图(Settings.ACTION_AIRPLANE_MODE_SETTINGS);
intentAirplaneMode.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intentAirplaneMode);
}
赶上(ActivityNotFoundException E){
Log.e(异常E +);
}
}
其他{
意图intent1 =新意图(android.settings.WIRELESS_SETTINGS);
intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent1);
}试试这个code希望它会工作。
I am opening the Flight Mode setting page with below code.
startActivity(new Intent(Settings.ACTION_AIRPLANE_MODE_SETTINGS));
It is working fine on the most of the devices. But on Samsung model = GT-19300 it throws an exception:
ActivityNot Found Exception.No Activity found to handle intent
{android.Settings.ACTION_AIRPLANE_MODE_SETTINGS}
What is the Intent string to open Flight Mode settings on Samsung devices?
解决方案if (android.os.Build.VERSION.SDK_INT < 17){ try{ Intent intentAirplaneMode = new Intent(Settings.ACTION_AIRPLANE_MODE_SETTINGS); intentAirplaneMode.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intentAirplaneMode); } catch (ActivityNotFoundException e){ Log.e("exception", e + ""); } } else{ Intent intent1 = new Intent("android.settings.WIRELESS_SETTINGS"); intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent1); }
try this code hope it will work.
这篇关于我应该如何编程打开三星设备的飞行模式设置页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文