Ah, I see where my problem is. The layout im calling is actually inside a viewflipper so it wasn't being seen. I fixed it. Thanks you!
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Kostya Vasilyev Sent: Tuesday, November 30, 2010 1:34 PM To: [email protected] Subject: Re: [android-developers] Change Relative layout background dynamically Issues Post your logcat output and the part of your layout xml file where you declare the RelativeLayout. I would guess that you either didn't assign an android:id to the relative layout, or using the wrong id with findViewById. Because of this, the value of "background" is null. -- Kostya 30.11.2010 20:57, Tommy пишет: > Hi everyone. > > I have a relative layout that I want to change the background > according to a set of features. For some reason when I try to change > the background image I get a null pointer exception. Currently in the > onStart method I call a function the handles valedating then determins > what background image should show. The code for the image change I > have is below: > > RelativeLayout background = > (RelativeLayout)findViewById(R.id.currentWeatherBackground); > > background.setBackgroundResource(R.drawable.blue_background); > > > blue_background is in my resource folder and I can use it just fine if > I type it into the XML. > > Could anyone please shed some light on what I am doing wrong? > > Thank you for your time and help, > > Tommy > -- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- 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 -- 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

