我有一个调用另一个应用程序的小部件,这是代码中最重要的部分:
final Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
final ComponentName cn = new ComponentName("com.android.settings",
"com.android.settings.wifi.WifiSettings");
intent.setComponent(cn);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctxt.startActivity( intent);
重要的部分是
final ComponentName cn = new ComponentName("com.android.settings", "com.android.settings.wifi.WifiSettings");
这调用了android中的wifi设置,但我在网站上发现了这个代码,我想知道如何在系统中调用数据漫游和其他设置,在哪里可以看到这个?
答案 0 :(得分:2)
com.android.settings
是包的名称。如果您转到here,您可以找到此套餐中提供的所有设置。漫游设置位于com.android.phone
包中 - 请参阅here 。
编辑:使用包名称的appears不可移植。最好的办法是使用:
startActivity(new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS));
意图列表位于Settings class
您may also need将FLAG_ACTIVITY_NEW_TASK
添加到您的意图