setImageDrawable android code example
Example: setimagedrawable in android
int id = getResources().getIdentifier("yourpackagename:drawable/" + StringGenerated, null, null);
int id = getResources().getIdentifier("yourpackagename:drawable/" + StringGenerated, null, null);