我想从我的应用程序中打开 Android4.2 设置 WifiDisplaySettingsActivity。
我试过了
Intent i;
PackageManager manager = getActivity().getPackageManager();
try {
i = manager.getLaunchIntentForPackage("com.android.settings.wfd");
if (i == null)
throw new PackageManager.NameNotFoundException();
i.addCategory(Intent.ACTION_MAIN);
startActivity(i);
} catch (PackageManager.NameNotFoundException e) {
}
和
final Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
final ComponentName cn = new ComponentName("com.android.settings.wfd","com.android.settings.wfd.WifiDisplaySettings");
intent.setComponent(cn);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
但他们都不能工作。我去AndroidManifest.xml看代码
<activity android:name="Settings$WifiDisplaySettingsActivity"
android:label="@string/wifi_display_settings_title"
android:taskAffinity=""
android:excludeFromRecents="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.settings.WIFI_DISPLAY_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.wfd.WifiDisplaySettings" />
</activity>
问题是我知道它是一个片段类,我知道它的包名是 com.android.settings.wfd,但我仍然不知道如何打开它,尤其是我不知道如何处理这样的活动名称
设置$WifiDisplaySettingsActivity
有人可以给我建议吗???plz....非常感谢
问题是它的 settings.WIFI_DISPLAY_SETTINGS 但不是 ACTION_WIFI_SETTINGS,所以 eclipse 无法编译
附加:
public final class WifiDisplaySettings extends SettingsPreferenceFragment implements PersistentGroupInfoListener {
private static final String TAG = "WifiDisplaySettings";
private static final int MENU_ID_SCAN = Menu.FIRST;
private static final int MENU_ID_CREATE_GROUP = Menu.FIRST + 1;
private static final int MENU_ID_REMOVE_GROUP = Menu.FIRST + 2;
它是设置偏好片段......那我该如何打开它???