I have this exact same problem as here:
http://groups.google.com/group/android-beginners/browse_frm/thread/daa2634b42a2975/415dd6e5bf920157?lnk=gst&q=How+to+declare+images+for+ImageView#415dd6e5bf920157

ImageView IV;
IV = (ImageView) findViewById(R.drawable.top);
IV.setImageResource(R.drawable.quantity);  //<-- NullPointerException
right here!!!

-the image shows up fine in the layout editor when I click the
"Layout" tab
-changing the image source in xml work fine
-in debug, evaluating the expression R.drawable.quantity returns a
number
-in debug, evaluating IV.setImageResource() with what
R.drawable.quantity's integer value == NPE
-deleting R.java and letting Eclipse rebuild did not fix the problem.

I have also tried making six ImageViews in xml, each with a different
drawable assigned in xml and using setVisibility(View.GONE) to turn
things off and setVisibility(View.VISIBLE) to turn things on.  This
also causes an NPE.  Any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to