12

I am using Following Code to start setting I want to launch the setting activity which is started by android ins

PackageList allowedAppsPackageName=CallHelper.Ds.getPackageList();
            PackageManager manager = CallDetectService.packageManager;
            Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
            mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);

        final List<ResolveInfo> apps = manager.queryIntentActivities(mainIntent, 0);
        Collections.sort(apps, new ResolveInfo.DisplayNameComparator(manager));
        final int count = apps.size();
        ResolveInfo info=new ResolveInfo();;
        GridViewAppList.clear();

                 for (int i = 0; i < count; i++) 
                 {

                        info= apps.get(i);
                        if(info.activityInfo.applicationInfo.packageName.contains("setting"))
                            break;

                 }
                ApplicationInfo application = new ApplicationInfo();

                application.title = info.loadLabel(manager);
                application.setActivity(new ComponentName(
                        packageName,
                        info.activityInfo.name),
                        Intent.FLAG_ACTIVITY_NEW_TASK
                        | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
                application.icon = info.activityInfo.loadIcon(manager);
                application.packagename=packageName;
                Log.i("PKG", application.packagename+" "+packageName+" "+info.activityInfo.name);
                GridViewAppList.add(application);
4

2 に答える 2

0

クラスには多くのアクション定数がありSettings、提供されたサブ設定のアクティビティを開始するインテントを作成したり、アクションに応じて単に設定アプリを起動したりするために使用できます。

例えば:

intent = new Intent(Settings.ACTION_SETTINGS); // ACTION_SETTINGS will start the Settings app

intent = new Intent(Settings.ACTION_WIFI_SETTINGS); // ACTION_WIFI_SETTINGS will show the WiFi settings
于 2014-04-16T14:26:24.540 に答える