android - How to get notification icon of other app? -


i'm using notificationlistenerservice catching notification, of kpbird blog. i'm unable extract icon's drawable. i'm going through this, things not cleared me. please help.

to other application icon, package name of application , use below code. package name notification instance.

string pack= "com.whatsapp" // ex. whatsapp;         context remotepackagecontext = null;          bitmap bmp = null;         try {               remotepackagecontext = getapplicationcontext().createpackagecontext(pack, 0);               drawable icon = remotepackagecontext.getresources().getdrawable(id);               if(icon !=null) {                   bmp = ((bitmapdrawable) icon).getbitmap();             }          } catch (exception e) {               e.printstacktrace();           } 

Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

1111. appearing after print sequence - php -