how to open Accessibility Settings of my app directly?

泄露秘密 提交于 2020-01-12 02:25:47

问题


As mentioned here: How can I start the Accessibility Settings Page of my APP in Android? I can open my app Accessibility Settings directly with this code:

Intent intent = new Intent();
        intent.setClassName("com.android.settings",
                "com.android.settings.Settings");
        intent.setAction(Intent.ACTION_MAIN);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                | Intent.FLAG_ACTIVITY_CLEAR_TASK
                | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
        intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT,
                "the fragment which you want show");
        intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS,
                extras);
       startActivity(intent);

but I tested many things like app name, package name, service class name and etc instead of "the fragment which you want show" but does not worked.


回答1:


Like so:

Intent intent = new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS);
startActivityForResult(intent, 0);


来源:https://stackoverflow.com/questions/31802650/how-to-open-accessibility-settings-of-my-app-directly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!