Will wrote: > 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!!!
R.drawable.top is not a valid identifier of a widget in your layout. Have you tried R.id.top instead? Or something else in the R.id namespace? One of the downsides of all of the R.* series being int values is that you can pass R.drawable values where R.id values are needed. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Published! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

