• Post Reply Bookmark Topic Watch Topic
  • New Topic

Update the List View at run time  RSS feed

 
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
 
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.
 
author
Bartender
Posts: 5856
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.
 
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.
 
When it is used for evil, then watch out! When it is used for good, then things are much nicer. Like this tiny ad:
Thread Boost - a very different sort of advertising
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!