How can i get the application's icon from the package name?

后端 未结 4 1721
忘了有多久
忘了有多久 2020-12-01 03:26

I have tried various solution from stack overflow with no luck. What I want.

  1. I know package name of different applications.
  2. I want to get application
4条回答
  •  渐次进展
    2020-12-01 03:48

    if you want to get icon (picture) of any installed application from there packagename, then just copy and paste this code. it will work

    try
    {
        Drawable d = getPackageManager().getApplicationIcon("com.AdhamiPiranJhandukhel.com");
        my_imageView.setBackgroundDrawable(d);
    }
    catch (PackageManager.NameNotFoundException e)
    {
        return;
    }
    

提交回复
热议问题