在Android中查找要与ComponentName类一起使用的类

时间:2012-04-24 12:16:15

标签: android

我有一个调用另一个应用程序的小部件,这是代码中最重要的部分:

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设置,但我在网站上发现了这个代码,我想知道如何在系统中调用数据漫游和其他设置,在哪里可以看到这个?

1 个答案:

答案 0 :(得分:2)

com.android.settings是包的名称。如果您转到here,您可以找到此套餐中提供的所有设置。漫游设置位于com.android.phone 包中 - 请参阅here

编辑:使用包名称的appears不可移植。最好的办法是使用:

startActivity(new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS));

意图列表位于Settings class

may also needFLAG_ACTIVITY_NEW_TASK添加到您的意图