Thanks a lot, it's very simple to do.
On 30 Nov, 10:38, pedr0 <[email protected]> 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? > > On 30 Nov, 10:34, Sarwar Erfan <[email protected]> wrote: > > > > > > > > > ImageButton constructor takes the context as input > > parameterhttp://developer.android.com/reference/android/widget/ImageButton.html > > > b = new ImageButton(this); > > > Regards > > Sarwar Erfan > > > On Nov 30, 3:27 pm, Sarwar Erfan <[email protected]> wrote: > > > > 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 you want multiple image > > > buttons. > > > b = new ImageButton(); > > > > Regards > > > Sarwar Erfan > > > > On Nov 30, 3:18 pm, pedr0 <[email protected]> wrote: > > > > > Hi at all, > > > > > I have to put some ImageButton inside an LinearLayout, but I don't > > > > know the number of this statically, so because I keep the data through > > > > internet at run-time. > > > > > I solved this problem adding new child at the layout at run time after > > > > the oncreate() functions is called in this way: > > > > > ImageButton b; > > > > LinearLayout contanier = (LinearLayout) > > > > findViewById(R.id.card_images_layout); > > > > for (int i = 0; i < this.card.images.size(); i++) { > > > > b = (ImageButton) findViewById(R.id.card_image); > > > > b.setImageBitmap((this.card.images.get(i).getImage_data())); > > > > contanier.addView(b); > > > > > } > > > > > But I take this error > > > > > java.lang.IllegalStateException: The specified child already has a > > > > parent. You must call removeView() on the child's parent first > > > > > Is my solution which is incorrect or I make wrong something? > > > > > Thanks a lot > > > > > pedr0 -- 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

