setBackgroundResource() relative layout

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

setBackgroundResource() relative layout

Postby akshaydashrath » Thu Jan 07, 2010 2:49 pm

Hello all,

I cant seem to be able to setBackgroundResource() for a relative layout. It ends up crashing the application. Any suggestions?

Thanks,

Akshay
akshaydashrath
Freshman
Freshman
 
Posts: 9
Joined: Mon Dec 14, 2009 11:38 pm
Location: UK

Top

Postby wirelessdesigns » Thu Jan 07, 2010 8:42 pm

Maybe you could provide a little more information about the context where you are using it, and perhaps the exception or other errors that LogCat provides when the application crashes?

What parameter is being passed in? Is it a valid resource from R.drawable?
wirelessdesigns
Developer
Developer
 
Posts: 25
Joined: Fri Dec 18, 2009 3:27 pm
Location: Littleton, CO

Postby akshaydashrath » Thu Jan 07, 2010 8:45 pm

wirelessdesigns wrote:Maybe you could provide a little more information about the context where you are using it, and perhaps the exception or other errors that LogCat provides when the application crashes?

What parameter is being passed in? Is it a valid resource from R.drawable?


Hey Dave,

I sorted it out, thanks for replying. The resource was valid and I was getting a Null Pointer Exception. I basically had an image background for a RelativeLayout that enclosed 3 text views. And during execution of the program I wanted to change the background of the relative layout, which caused the exception. Basically in order to implement the idea I used the background for one of the text views which I passed the fill_parent parameter for width and height and arranged the other text views accordingly.
akshaydashrath
Freshman
Freshman
 
Posts: 9
Joined: Mon Dec 14, 2009 11:38 pm
Location: UK

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 7 guests