Sorry about the late response.
Here's what I meant by the potential casting problem; In order to add the ImageView variable, which was created to handle the Drawable resource, you need to cast the parent layout, which is of type ImageView, to ViewGroup type if you're planning to use the addView() method. I've tried this already and got into trouble with the "casting" ... I guess it's because ViewGroup is an abstract class. Emre > Date: Sat, 25 Jul 2009 11:52:53 -0400 > From: [email protected] > To: [email protected] > Subject: [android-developers] Re: Handling a layout ... > > > Emre A. Yavuz wrote: > > "You can, but then the child is already added to the parent; you do not > > need to add it yourself." > > > > I agree with you, but if you're not going to store this info in the > > layout, the only option left seem to be refering it using its > > "R.drawable.childview". > > R.drawable.childview is a references to a Drawable resource > (res/drawable) and is not a reference to a View in a layout. > > > How can you convert this, an integer, to a View > > then ? Should I create an ImageView variable and use its > > setImageresource() method ? > > Yes. Then you need to add that to some parent layout via addView() as > previously described. > > > but will there be a casting problem in that case ? > > I do not understand this question. > > > The DDMS perspective in Eclipse doesn't tell me anything at all. I get a > > message from the emulator saying that the application has stopped working. > > The DDMS perspective contains a panel(?) called LogCat, which will give > you a stack trace when an exception occurs. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://twitter.com/commonsguy > > _Android Programming Tutorials_ Version 1.0 In Print! > > > _________________________________________________________________ Stay in the loop and chat with friends, right from your inbox! http://go.microsoft.com/?linkid=9671354 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

