wood burning stoves
The moose likes Android and the fly likes Update the List View at run time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Update the List View at run time" Watch "Update the List View at run time" New topic

Update the List View at run time

Apt Gopal

Joined: Dec 07, 2010
Posts: 25

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

Joined: Jan 02, 2010
Posts: 56

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

Joined: May 14, 2008
Posts: 5852

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.

JBoss In Action
Monu Tripathi

Joined: Oct 12, 2008
Posts: 1369

See API Demos - using List in transcript mode. Similar to what PJ outlined.

[List of FAQs] | [Android FAQ] | [Samuh Varta]
I agree. Here's the link: http://aspose.com/file-tools
subject: Update the List View at run time
jQuery in Action, 3rd edition