On Thu, Oct 14, 2010 at 11:05 AM, Prakash Iyer <[email protected]> wrote:
> In the getView there is a convertView parameter. I didn't see much
> documentation around it but given it's name and the source, I assume this is
> where the View object gets reused. In other words, if I don't do a setText
> here if the incoming parameter is non-null, I should see names/labels (of
> list items) getting recycled? I assume the framework has atmost X views
> alive where X could be less than the total count of items and more than a
> screenful. Am I correct or reading too much into this?

That sounds about right.

> Now, I have a TextView which I supply ArrayAdapter and then a TableLayout
> which is made visible on demand. The table can have upto N, say 50, rows.
> Each row has 2 columns, an immutable name column and then the variable value
> column. Not every item will have N rows, and which of the N rows are present
> will vary as well. So, is the most efficient means of doing this,
>
> Have the view supplied to ArrayAdapter have the TableLayout with N rows, all
> with Visibility of Gone and then fill in the vaalues in getView and set
> Visibility appropriately
> View given to ArrayAdapter has the TextView and nothing else. Create one
> TableLayout object, N TableRow objects. Add/remove TableRow objects to the
> TableLayout singleton and add/remove the TableLayout singleton from the
> appropriate View in getView
> Something else altogether

Off the cuff, I'd go with "something else altogether", in terms of a
completely different UI implementation. I do not think your approach
will be very user-friendly, particularly on smaller screens. Why are
you forcing all of this into a single ListView? Why not:

-- A ListView above and a single TableLayout (perhaps in a ScrollView)
below, where the TableLayout's contents change based upon clicks in
the ListView

-- A ListView in one activity and the details (in a TableLayout or
whatever) in a second activity, started by clicking on a ListView row
in the first activity?

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in London: http://skillsmatter.com/go/os-mobile-server

-- 
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

Reply via email to