Ben Griffiths wrote:
> I would like to implement a UI that behaves in a similar way to
> editing/adding contacts on official contact app. Specifically, I would
> love the user to be able to press a button to add as many EditText
> parts as they need. This sounds like a jobs for adapters!

Uh, maybe.

> That is as
> pretty much as far as I can deduce... How to use adapters (beyond the
> myriad of Gallery, ListView, Spinner examples) seems to elude me and
> if anyone can give me a simple example, or just an idea as how to
> implement it, as a start point that would be fantastic.
> 
> I downloaded the contacts source but it is beyond me to be honest, and
> far more complex than what my solution requires - it deals with a lot
> of generics which I will not be needing.

Well, what you're asking isn't exactly a common UI pattern. Not that
it's a bad UI pattern, but if you're expecting tons of worked-out
examples, you may be disappointed.

On custom Adapters in ListViews, here's an excerpt from one of my books
that discusses the topic:

http://commonsware.com/Android/excerpt.pdf

In your case, you're not actually trying to show a list of data, but
rather a collection of semi-random Views (in your case, EditText
widgets). You could do that via an Adapter, such as my SackOfViewsAdapter:

http://github.com/commonsguy/cwac-sacklist

(though mine would require some modification to support injecting new
Views on the fly)

Or, this could be a LinearLayout in a ScrollView, and you are modifying
the roster of children of the LinearLayout at runtime.

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

_Android Programming Tutorials_ Version 1.0 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to