Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Application Info from package name

Tags:

android

I have an application package name. Is there any way to get the icon, name of this application ? package name example: com.example.name

like image 714
KhalidTaha Avatar asked Jan 19 '13 19:01

KhalidTaha


1 Answers

Try something like:

    try {         ApplicationInfo app = this.getPackageManager().getApplicationInfo("com.example.name", 0);                  Drawable icon = packageManager.getApplicationIcon(app);         String name = packageManager.getApplicationLabel(app);         return icon;     } catch (NameNotFoundException e) {         Toast toast = Toast.makeText(this, "error in getting icon", Toast.LENGTH_SHORT);         toast.show();         e.printStackTrace();     } 
like image 166
Raghav Sood Avatar answered Oct 18 '22 07:10

Raghav Sood