概述
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
android:label="@string/wifi_display_settings_title"
android:taskAffinity=""
android:excludeFromRecents="true">
android:value="com.android.settings.wfd.WifiDisplaySettings" />
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???
最后
以上就是柔弱麦片为你收集整理的android setting wifi,android - how to open WifiDisplay Setting from another app? - Stack Overflow的全部内容,希望文章能够帮你解决android setting wifi,android - how to open WifiDisplay Setting from another app? - Stack Overflow所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复