Sheehan Alam Sheehan Alam - 1 year ago 120
Android Question

How to set a PNG file to an ImageView?

I have a file called

nochart.png
in
/drawable
.

How can I set this to an ImageView?

chartImageView.setImageDrawable(R.drawable.nochart);


Does not compile.

Answer Source

Use:

chartImageView.setImageResource(R.drawable.nochart);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download