1

I have a list view made using custom Adapter & contains 2 text view in each row, I want to update data of rows , when I long pressed on row.

Enzokie
  • 7,365
  • 6
  • 33
  • 39
ulti72
  • 79
  • 1
  • 9

3 Answers3

2

Just update your model object according to the need and call notifyDataSetChanged() inOnLongClickListener or OnItemLongClickListener of ListView. List data will update.

Mohammad Misbah
  • 870
  • 8
  • 19
1

Go to your custom adapter, and set an OnLongClickListener on the view you return in getView(). In the OnLongClickListener update the array or list you are using and when finished, call notifyDataSetChanged() on the ListView.

Sean Goudarzi
  • 1,244
  • 1
  • 10
  • 23
0

Try this:

listView.setOnItemLongClickListener(new OnItemLongClickListener() {
            @Override
            public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
                    int pos, long id) {
                adapter.notifyDataSetChanged();
                return true;
            }
        }); 
Nick Titov
  • 588
  • 5
  • 19