2

So, I formulated my question in the header of topic. My task is the updating textview's of ListView.

Thanks a lot!

3
  • 1
    have you tried to google first? stackoverflow.com/questions/4540754/… Commented Feb 13, 2012 at 15:38
  • did u tried listview.invalidate(); Commented Feb 13, 2012 at 15:39
  • 2
    You shouldn't use 'listview.invalidate()', unless you are using custom components you will probably never need to call this, android will do it when it needs to. Commented Feb 13, 2012 at 15:43

2 Answers 2

2

To update the list use list.notifyDataSetChanged();, and to add items just add them to your items list that you feed into the adapter

Sign up to request clarification or add additional context in comments.

2 Comments

Can you hint me how to insert new item in certain position oа ListView?I'm trying to do as I updated the question - but I have inserted item at the botton of ListView. Sorry for stupid question - I found insert method in adapter/
you can use a second "buffer list" to hold your items, and using a for loop insert your items from your main list until the position where your new item should be inserted, then add your new item, then continue adding the rest of the items from your main list using position+1 item because of the extra item you added. BAM! there's your new list with the item added wherever you want
2

In order to add an item to the ListView you will need to add an item to the adapter that contains all the data, and call setAdapter() on the ListView again. If you need more specific help please post some of your code.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.