how to open Accessibility Settings of my app direc

2020-05-24 05:40发布

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条回答
甜甜的少女心
2楼-- · 2020-05-24 06:20

Like so:

Intent intent = new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS);
startActivityForResult(intent, 0);
查看更多
登录 后发表回答