Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Update the List View at run time

 
Apt Gopal
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am creating a new android application in that app I want add the list content from the Edit text

That means I have a Edit text field,Button,List View I write some thing in edit text and at the time of button clicking I want to add the content in the list view

Please any one help me

Thanks in Advance
 
Misha van Tol
Ranch Hand
Posts: 56
Android Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let us see what code you have so far, or show some pseudo-code of what you have in mind.
Then we can discuss it here.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, I am just now doing this same thing. Here is what I did:

1) In the layout XML file, I included a ListView with the id "@android:id/list"
2) I create an activity class that extended ListActivity (which automatically handles the ListView declared in the layout file)
3) I created an adapter class that extended ArrayAdapter, and hooked that to the activity (the adapter maintains the list contents)
4) When I got the input from the EditText field, I used Adaptor.add() to add the new entry to the list.
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See API Demos - using List in transcript mode. Similar to what PJ outlined.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic