views:

34

answers:

2

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.

+4  A: 

Use chartImageView.setImageResource(R.drawable.nochart);

skorulis
A: 

you can also set the image using an xml file with the following attriblute

android:src="@drawable/nochart"
Jared