简体   繁体   English

Android中“设置”页面的ApplicationInfo

[英]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_SETTINGSSettings.ACTION_BATTERY_SAVER_SETTINGSApplicationInfo ,以便可以直接启动它们。

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.

相关问题 Android ApplicationInfo是游戏吗? - Android ApplicationInfo is a game? Android上的ApplicationInfo静态方法 - ApplicationInfo on Android in static method Android - 从ApplicationInfo实例启动应用程序 - Android - Starting an application from an ApplicationInfo instance 如何通过android中的应用程序uid获取ApplicationInfo? - How to get ApplicationInfo by application uid in android? Android:applicationInfo.loadDescription()始终返回null - Android: applicationInfo.loadDescription() always returning null Android中的ApplicationInfo适配器仅显示具有启动器意图的应用程序 - ApplicationInfo adapter in Android to display only apps with launcher intent 找不到方法android.content.pm.ApplicationInfo.loadLogo - Could not find method android.content.pm.ApplicationInfo.loadLogo RecyclerView:尝试调用虚拟方法 'android.content.pm.ApplicationInfo android.content.Context.getApplicationInfo()' - RecyclerView: Attempt to invoke virtual method 'android.content.pm.ApplicationInfo android.content.Context.getApplicationInfo()' “尝试在空对象引用上读取字段'int android.content.pm.ApplicationInfo.targetSdkVersion'”异常 - “Attempt to read from field 'int android.content.pm.ApplicationInfo.targetSdkVersion' on a null object reference” exception java.lang.NullPointerException:尝试调用虚拟方法'android.content.pm.ApplicationInfo - java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.ApplicationInfo
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM