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
Post a Comment