When user clicks a button, these 3 lines are executed: button = new ImageButton(context); button .setImageResource(R.drawable.buttonJPG); layout.addView(button, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
I observe that during the first add, it takes about 3.5 seconds. Subsequent adds are much quicker at about 0.5 sec. On actual devices, it will be many times slower. thanks, Anil On Apr 3, 6:29 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote: > I highly doubt this number since during a scroll, ListView basically > adds and removes Views all the time. It certainly doesn't take 3 > seconds. There must be a bottleneck somewhere in your application. > > > > On Thu, Apr 3, 2008 at 2:50 PM, Anil <[EMAIL PROTECTED]> wrote: > > > I have to say this - adding a button dynamically to a layout is > > *extremely* slow. > > It takes about 3 seconds for the button to be added! > > > On Apr 3, 3:40 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > You cannot do this. If you try to put the same View in different > > > layouts, an exception will be thrown anyway. > > > > On Thu, Apr 3, 2008 at 1:34 PM, Anil <[EMAIL PROTECTED]> wrote: > > > > > I need to use the same buttons in several list items - each of which > > > > is a nested layout. > > > > Instead of creating a new button each time, to save time and space, I > > > > am going to reuse the same button, adding it to each layout. Of > > > > course, each OnClickListener will have to figure out which list item > > > > was clicked. > > > > Are there any unintended or harmful side effects to this? > > > > thanks, > > > > Anil > > > > -- > > > Romain Guywww.curious-creature.org > > -- > Romain Guywww.curious-creature.org --~--~---------~--~----~------------~-------~--~----~ 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] 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-developers?hl=en -~----------~----~----~----~------~----~------~--~---

