How to get the application label from ApplicaitonInfo class in android. I need to get application label as in default share dialog that we get in Marshmallow.
Asked
Active
Viewed 97 times
1 Answers
0
The share dialog get the labels from the ResolveInfo
object LINK.
It get those objects by calling:
List<ResolveInfo> targets = packageManager.queryIntentActivities(targetIntent, 0);
in the ResolveInfo
you can get the label using:
resolveInfo.loadLabel(packageManager);

Budius
- 39,391
- 16
- 102
- 144
-
I was using packageManager.getApplciationInfo to get applciation name which was not providing Tweet and Direct Message,It was providing Only Twitter itself.Your piece of code works fine. – Anand DR Aug 17 '16 at 11:54
-
@AnandDR ApplicationInfo have info about "everything inside the APK together". ResolveInfo gives you a direct intent, which one application can have more than one intent-filter that match your share requirements. – Budius Aug 17 '16 at 14:10