Reputation: 2070
I'm trying to develop an android app that could list all app's which has cache, I successfully got the information about cache, but now I want to display those app which has some cache in the screen, I have the package name, but problem is how to get the application name from package name,
Let's say package name is com.android.browser
then app name will be Browser
How to achieve this task ?
Please don't mind if this question is silly to you, please help me in solving this riddle, Thanks in advance.
Upvotes: 5
Views: 13759
Reputation: 75619
You need to use PackageManager
to get detailed information about installed packages.
PackageManager packageManager = context.getPackageManager();
ApplicationInfo applicationInfo = null;
try {
applicationInfo = packageManager.getApplicationInfo(packageName, 0);
} catch (final NameNotFoundException e) {}
final String title = (String)((applicationInfo != null) ? packageManager.getApplicationLabel(applicationInfo) : "???");
Upvotes: 15
Reputation: 3121
Try to use PackageManager#getActivityInfo();
There is field which contain app name.
Upvotes: 0