I want to open Android4.2 setting WifiDisplaySettingsActivity from my app.
I tried
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) {
}
and
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);
but none of them could work. I went to the AndroidManifest.xml to see code
<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>
the question is I know it's a fragment class and I know it's package name is com.android.settings.wfd, but I still don't know how to open it, especially I don't know how to handle activity name like this
Settings$WifiDisplaySettingsActivity
Can some one give me advices???plz....thank you very much
the problem is it's settings.WIFI_DISPLAY_SETTINGS but not ACTION_WIFI_SETTINGS, so the eclipse can't compile
addional:
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;
it's Setting Preference Fragment ... so how do I open it???