3

enter image description here

Hi,

I want to implement form like in the image, dont have idea how they are adding Fields dynamically. Is this a ListView? Expandable List? user can add and remove at runtime. I have checked Expandable List which contains child items. but we define child in array, In the image they add dynamically.

Any guide/link

Thanks

ALi
  • 430
  • 7
  • 19

1 Answers1

1

Custom ListView Adapters are often back by Collections, like List, ArrayList, etc. These lists may contain your custom objects, where the Adapter determines what to display based on the object properties. The lists can be managed/altered in typical fashions, like add() remove(), etc.

Do a Google search for "android custom list adapters" to learn more.

Here is an example of dynamically creating list rows with a "plus" buttons to add more rows. Should give you a good start: Dynamically add elements to a listView Android

You can always look at the source of the Android contacts app, as well.

Community
  • 1
  • 1
Paul Burke
  • 25,496
  • 9
  • 66
  • 62
  • Hi, I have tried different tutorials, but problem is how to add and remove content in the place of Item at runtime. – ALi Mar 20 '12 at 05:27
  • Like in the image, Email Group has add and remove button. – ALi Mar 20 '12 at 05:28
  • Did you check the link I added above? It appears that you need to brush up on Java, first. This method dynamically adds list items `public void addItems(View v) { listItems.add("Clicked : "+clickCounter++); adapter.notifyDataSetChanged(); }`. Removing would simple be something like `listItems.remove(index); adapter.notifyDataSetChanged();` – Paul Burke Mar 20 '12 at 15:06