[英]ApplicationInfo for Settings pages in android
I'm trying to get the ApplicationInfo for Settings.ACTION_ACCESSIBILITY_SETTINGS or Settings.ACTION_BATTERY_SAVER_SETTINGS , so that I can launch them directly. 我正在尝试获取Settings.ACTION_ACCESSIBILITY_SETTINGS或Settings.ACTION_BATTERY_SAVER_SETTINGS的ApplicationInfo ,以便可以直接启动它们。
I tried following steps but it's return setting's ApplicationInfo . 我尝试了以下步骤,但它返回设置的ApplicationInfo 。
private static final String[] SETTINGS_ACTION_MENUS = new String[]{
Settings.ACTION_ACCESSIBILITY_SETTINGS,Settings.ACTION_ADD_ACCOUNT};
public void getSettingPages(){
for(String menu : SETTINGS_ACTION_MENUS){
final Intent intent = new Intent(menu);
ComponentName componentName = intent.resolveActivity(packageManager);
if(componentName != null){
try {
ApplicationInfo info = packageManager.getApplicationInfo(componentName.getPackageName(),0);
if(packageManager.getLaunchIntentForPackage(info.packageName) != null){
launchableApps.add(info);
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
}
}
}
I tried following steps but it's return setting's ApplicationInfo
我尝试了以下步骤,但返回设置的ApplicationInfo
That is because those Intent
actions are tied to activities in the Settings app. 这是因为这些
Intent
操作与“设置”应用中的活动相关联。 Individual activities do not have their own ApplicationInfo
. 各个活动没有自己的
ApplicationInfo
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.