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