Why is this code giving me an error?
<p>The following code gave me an error</p>

<pre><code>public class SuperImage3Activity extends Activity 
{

    ImageView image1, image2;

    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        image1 = (ImageView)findViewById(R.drawable.sourceimage1); // error here

        image2 = (ImageView)findViewById(R.drawable.sourceimage2); // error here

    }
</code></pre>

<p>I indeed created a directory named drawable and placed sourceimage1.jpg and sourceimage2.jpg in the directory.</p>

<p>the recommendation given by Eclipse is, </p>

<p>"As of ADT 14, the resource fields (such as doraemon) are no longer constants when defined in library objects.
This is necessary to make library projects resuable without recompiling them.  </p>

<p>One consequence of this is that you can no longer use the fields directinly in switch statements.
You must use an if-else chain instead
"</p>
