Android Imageview Set Image From Drawable Programmatically

[Solved] Android Imageview Set Image From Drawable Programmatically | Scala - Code Explorer | yomemimo.com
Question : android display drawable in imageview

Answered by : calm-cod-jjlnkpmaadk2

img=(ImageView)findViewById(R.id.imageview1);
Drawable myDrawable = getResources().getDrawable(R.drawable.imageView1);
img.setImageDrawable(myDrawable);

Source : https://stackoverflow.com/questions/16641376/set-imageview-to-a-drawable-android/39603707 | Last Update : Wed, 14 Apr 21

Question : how to set drawable name to imageview programmatically

Answered by : stockholm

String uri = "@drawable/myresource"; // where myresource (without the extension) is the file
int imageResource = getResources().getIdentifier(uri, null, getPackageName());
imageview= (ImageView)findViewById(R.id.imageView);
Drawable res = getResources().getDrawable(imageResource);
imageView.setImageDrawable(res);

Source : https://stackoverflow.com/questions/11737607/how-to-set-the-image-from-drawable-dynamically-in-android | Last Update : Tue, 28 Apr 20

Question : how to create a new imageview in android java

Answered by : uninterested-unicorn-m2z3xyd1ej6z

ImageView move = new ImageView(this);

Source : | Last Update : Tue, 01 Dec 20

Answers related to android imageview set image from drawable programmatically

Code Explorer Popular Question For Scala