PackageManager pm = this.getPackageManager();

        Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
        mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);

        List<ResolveInfo> list = pm.queryIntentActivities(mainIntent,
0);
        for(ResolveInfo info: list)
        {
          Log.w("App browser",
info.activityInfo.applicationInfo.loadLabel( pm ).toString());
        }

On Apr 18, 8:50 am, sam <[email protected]> wrote:
> Given the following code, I know how togeta list of ResolveInfo that
> describes all of theinstalledapplications, but I am not sure how togetthe 
> names of theapplicationsas seen in the home menu.
>
> PackageManager pm = this.getPackageManager();
>
> Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
> mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
>
> List<ResolveInfo> list = pm.queryIntentActivities(mainIntent, 0);
>
> Currently I cangetthe packageName and className of a given
> application as such:
>
> ResolveInfo re = list.get(position);
> String packageName = re.activityInfo.packageName;
> String className = re.activityInfo.name;
>
> But as far as getting the same name that you would find if you were to
> do
>
> Context ctx = this;
> Resources appR = ctx.getResources();
> CharSequence txt = appR.getText(appR.getIdentifier("app_name",
> "string", ctx.getPackageName()));
>
> I cannot seem to figure out how to justgetthe name.  Obviously this
> is possible because there areapplicationsthat replace your home
> screen and so forth, but I have been searching for hours to no avail.
>
> Thanks!
>
> -Sam
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to