我该如何开始我的Android应用程序的辅助功能设置页面? [英] How can I start the Accessibility Settings Page of my APP in Android?
问题描述
我开发一个Android应用程序的基础上辅助功能。因为它不能以编程方式启用/禁用辅助服务在Android中(见<一href="http://stackoverflow.com/questions/10061154/how-to-programmatically-enable-disable-accessibility-service-in-android">How以编程方式启用/禁用辅助服务在Android中),所以我引导用户可访问设置页面(如图1),通过下面的code:
I am developing an Android APP based on Accessibility feature. As it can't programmatically Enable/Disable Accessibility Service in Android(See How to Programmatically Enable/Disable Accessibility Service in Android) , So I guide the user to Accessibility Settings Page(Pic 1) via the code below:
public static boolean gotoAccessibilitySettings(Context context) {
Intent settingsIntent = new Intent(
Settings.ACTION_ACCESSIBILITY_SETTINGS);
if (!(context instanceof Activity)) {
settingsIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
boolean isOk = true;
try {
context.startActivity(settingsIntent);
} catch (ActivityNotFoundException e) {
isOk = false;
}
return isOk;
}
,然后将用户需要找出我的应用程序的子设置标签,单击它,现在的辅助功能设置页面中我的应用程序显示(如图2)。
And then the user need to find out the Sub Settings Label of my APP, click it, and now the Accessibility Settings Page of my APP show(Pic 2).
我怀疑,如果任何方式开始我的应用程序的辅助功能设置页面(如图2)直接?
I doubt that if any way start my APP's Accessibility Settings Page(Pic 2) directly?
推荐答案
也许$ C $低于C可以帮助你:
Maybe the code below can help you :
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);
或者,你可以搜索关键词片段注入更多的信息 看看这个链接,这对你来说是有用的情况:
Or you can search the Key Word "Fragment Injection" for more information; Check out this link,it is useful for you case:
这篇关于我该如何开始我的Android应用程序的辅助功能设置页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!