Android gets system icon programmatically

I'm trying to use Java (not XML) to add a schema to the layout, and I can do this in the xml part, but I can’t figure out how to add a usable system to java?

in xml

android:Drawable="@android:drawable/cursor"

how to program in java

Resources res = getResources();
Drawable img = res.getDrawable(R.drawable.cursor);
+4
source share
1 answer

Just do it

Drawable img = res.getDrawable(android.R.drawable.cursor);
+9
source

All Articles