Sylvester Steele wrote: > dButton= (Button)this.findViewById(R.id.dButton); is I think where it > problem is. I played around a bit with it and realized that other > functions were also throwing up an exception. Then I just created a > new button, using new Button(this); and it worked fine. > > So, why is dButton= (Button)this.findViewById(R.id.dButton); not > working? > > note: dButton is part of an XML absoluteLayout that has been used as a > nested view for each item on a listView. This list view is visible. > and hence more than one instance of this button exists on the screen > at this time.
It is unclear who "this" is in "this.findViewById(R.id.dButton)". In order to find a child widget in your row View, "this" needs to be the row View. If "this" is your Activity, you probably don't have an R.id.dButton in your activity. If you are overriding getView() to create your rows, and if you are using getViewInflate().inflate() to instantiate the rows, you'll want to call findViewById() on the inflated row to get the button for that row. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ -- Available Now! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---