Get The App Icon As Int Identifier
I want to retrieve the icon of an app. If I use String pkg = 'com.app.my'; Drawable icon = getContext().getPackageManager().getApplicationIcon(pkg); The result is a Drawable. how
Solution 1:
s=name of the drawable
int id=getResources().getIdentifier(s,"drawable",getPackageName());
you will get the id here
Solution 2:
Use
getResources().getIdentifier() from your Context (e.g., Activity)
Solution 3:
Do you mean the icon of an other app, or the app you're in?
If it's in the app you're in, then this should be sufficient right?
int i = R.drawable.icon;
Post a Comment for "Get The App Icon As Int Identifier"