How can I get the application’s icon from the package name?

Try this:

try
{
    Drawable icon = getContext().getPackageManager().getApplicationIcon("com.example.testnotification");
    imageView.setImageDrawable(icon);
}
catch (PackageManager.NameNotFoundException e)
{
    e.printStackTrace();
}

Leave a Comment