1

I am able to Display the contents in a listview.But I want to edit that contents,Is it possible in android,If yes how to do it.I have not found anything on editing the item of the listview.The code below is to display listview

dataAdapter = new SimpleCursorAdapter(
                this, R.layout.row,
                cursor,
                columns,
                to);
        ListView listView = (ListView) findViewById(R.id.list);
        listView.setAdapter(dataAdapter);
4
  • Why not using an ArrayAdapter instead ?
    – Jscti
    Oct 30, 2012 at 14:26
  • @Bixi : how is the comment relevant to the question, and what would be so good about an arrayadapter ?
    – njzk2
    Oct 30, 2012 at 14:41
  • You cannot "edit" (change) the content of a ListView using a CursorAdapter because you cannot change the content of a Cursor. Oct 30, 2012 at 14:47
  • editing means to change the contents of the list items Oct 30, 2012 at 14:48

1 Answer 1

0

SimpleCursorAdapter is bound to a Cursor. So update the contents of the Cursor (requery for e.g.) then use dataAdapter.notifyDataSetChanged() to refresh the ListView.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.