In my app,I need to have delete button in my listview,So to do that I refer this link ListView with Add and Delete Buttons in each Row in android.
I refer the first answer,but the problem now is,in that they are adding items to the listview like this.
ArrayList<String> list = new ArrayList<String>();
list.add("item1");
list.add("item2");
But ,I fetch data to listview using cursor.Below one is my code to fetch data from database to listview.
private void fetchData() {
db = helper.getReadableDatabase();
Cursor c = db.query(DBhelper.TABLE1, null, null, null, null, null, null);
adapter = new SimpleCursorAdapter(
this,
R.layout.row,
c,
new String[]{DBhelper.Name},
new int[]{R.id.lblreload});
rldlist.setAdapter(adapter);
}
Now I don't have any idea,how to modify that code.please help me to solve this.