android - How to refresh cursorAdapter especially when deleting last item in a list? -


how refresh cursoradapter when deleting last item in list?


scenario:

working:

  • editing list-view row, ok
  • adding list-view row, ok
  • deleting list-view row(one one), until 1 left, ok

problem:

  • deleting last row/item, failed; need close first activity , open again refresh.

i using cursor adapter, , want refresh list when deleting last row/item of list view. method refreshing adapter assign new instance of cursoradapter listview(as if, doing again , again).

code:

listview.setadapter(new immunizationlistcursoradapter(                     this,// current activity                     r.layout.imm_list_row,// layout each row                     immunizationcursor,// data                     // pass in cursor bind to.                     // array of cursor columns bind to.                     new string[] { immunizationmodel.im_col_vacname,                             immunizationmodel.im_col_date },                             // parallel array of template objects bind                             //                             // columns.                             new int[] { r.id.text_vaccine_name,                             r.id.text_date_description })); 

there is.

any 1 can me? :((

all need call productcursor.requery() after each modification dataset.

requery() automatically triggers execution of query (in order retrieve new data) plus notification listview (by adapter) has refresh itself.

btw, until not long ago using same wrong method of assign new instance of cursoradapter...


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -