I followed your suggestion and created my own version of ArrayAdapter, overriding getView().
Everything works, however, with some logging, I'm finding that getView() is not called n times (n=number of items in list), but 2n+1 times (getView() is called 3 times for the first list item, two times apiece for the rest). This significantly increases my application startup time as I call ViewInflate everytime during getView(). Is this normal (should ArrayAdapter really be calling getView() more than n times)? And if so, any suggestions on how to optimize? Thanks, James On Apr 29, 12:38 pm, Mark Murphy <[EMAIL PROTECTED]> wrote: > kingkung wrote: > > Is there a simple way to do this through alistAdapter, like > >ArrayAdapter, etc.? The way I see it, anArrayAdapteris only able to > > fill in ALL of the textview A's first, and then all of the textview > > B's, and then all of the textview C's. But there are clearly some > > entries which don't have all three text views, and hence the array > > would leave an empty space for that entry. > > Create your own subclass ofArrayAdapterand override getView(). It will > be called for each one of your visible entries (#1, #2, #3, etc.). > There, you can construct your own View that includes whichever of A, B, > or C you need and return it. Those Views will then go into your overall > ListView. > > To create your own per-item Views, you can either build and connect them > in Java, or create a separate layout XML file for the items and use the > ViewInflate class to give you Views based on that layout, which you can > then fill in and customize (e.g., make unused ones invisible). > > -- > Mark Murphyhttp://commonsware.com > The Busy Coder's Guide to Android Development -- coming in June 2008! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

