Mark,
"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". How can you convert this, an integer, to a View then ? Should I create an ImageView variable and use its setImageresource() method ? I have just thought of this now and I haven't tried it yet, but will there be a casting problem in that case ? 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. Emre > Date: Fri, 24 Jul 2009 19:41:21 -0400 > From: [email protected] > To: [email protected] > Subject: Re: [android-developers] Re: Handling a layout ... > > You appear to have written to me directly by accident. Please keep > threads like this on-list, for the benefit of others. > > Emre A. Yavuz wrote: > > I was using findViewById() to get the layout which I wanted to modify > > and casting it to type ImageView afterward. However, you need to cast it > > to ViewGroup if you want to call addView() which means you need > > to update your code to cast it to ViewGroup instead. > > Correct. > > > The problem occurs when you call addView() to add the child view to the > > parent you want to modify. Don't you store the child view in your layout > > file under the handler for the parent view ? > > You can, but then the child is already added to the parent; you do not > need to add it yourself. > > > The code seems to > > crash when it tries to add the child view read by findViewById()method. > > You need to look at the Java stack trace, to see the error message and > where it occurred. The stack trace is in LogCat, accessible via adb > logcat, DDMS, or the DDMS perspective in Eclipse. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://twitter.com/commonsguy > > Looking for Android opportunities? http://wiki.andmob.org/hado _________________________________________________________________ More storage. Better anti-spam and antivirus protection. Hotmail makes it simple. http://go.microsoft.com/?linkid=9671357 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

