[android-developers] Re: addView in layout at run time

2010-11-30 Thread Sarwar Erfan
Hi, You are adding the same ImageButton again and again. You are getting reference of some existing button: b = (ImageButton) findViewById(R.id.card_image); and adding that button to the view again and again! So, you are getting the runtime error. Hint: You need to create NEW ImageButtons if

[android-developers] Re: addView in layout at run time

2010-11-30 Thread Sarwar Erfan
ImageButton constructor takes the context as input parameter http://developer.android.com/reference/android/widget/ImageButton.html b = new ImageButton(this); Regards Sarwar Erfan On Nov 30, 3:27 pm, Sarwar Erfan erfanonl...@gmail.com wrote: Hi, You are adding the same ImageButton again and

[android-developers] Re: addView in layout at run time

2010-11-30 Thread pedr0
Thanks a lot, but how to configure my botton like this: ImageButton android:layout_width=wrap_content android:layout_height=wrap_content / how can I set the layout_param at runtime? On 30 Nov, 10:34, Sarwar Erfan erfanonl...@gmail.com wrote: ImageButton constructor takes the

[android-developers] Re: addView in layout at run time

2010-11-30 Thread pedr0
Thanks a lot, it's very simple to do. On 30 Nov, 10:38, pedr0 pulsarpie...@gmail.com wrote: Thanks a lot, but how to configure my botton like this: ImageButton         android:layout_width=wrap_content         android:layout_height=wrap_content / how can I set the layout_param at runtime?