android - ListFragment doesn't refresh -


INTRODUCTION

I have found an app in which an acitivity is where I am Make the element and then I save these elements on a ListFragment. All this works well, but the problem comes when I try to remove an element from the list.

In short, the list paragraph does not refresh when I delete an element if I go back to main activity and then I re-enter the listframement, then the element I have removed Does not appear, but at this time I will remove an element to refresh this list.

That is to say that I am a little confused because first, it was doing right, but I do not know what I touched, now it does not come.

Code

This is the relevant code snippet of ListFragment:

  Public Class Extends MyPlacesListFragment ListFragment {/ / ... Last Category PlacescursorAdapter ResourceCursorAdapter {// ... Expands Override Public Zero at @Create (Bundle Saved InstantState) {Super.New (Saved Instantstate); GetAdapter (); } Public Zero getAdapter () {cursor C = getActivity (). GetContentResolver () Query (PlacesProvider.CONTENT_URI, Projection, Blank, Blank, Blank); MCursorAdapter = New Place Cursors Adapter (getActivity (), c); SetListAdapter (mCursorAdapter); } Private zero deletionem (long id) {Uri uri = ContentUris.withAppredId (PlacesProvider.CONTENT_URI, ID); GetActivity () GetContentResolver () Remove (Yuri, Blank, Blank); }   

I have to say that I work with databases and content providers, but this work is fine, I have tested them with other apps

its In addition, inform me (inform) on this method to insert, update, and delete the provider (s):

  getContext (). GetContentResolver () , Zero);  

Just call it:

  mCursorAdapter NotifyDataSetChanged ();   

After making changes to your underlying data.

In addition, I recommend changing your getAdapter () method to name a misleading name, IMHO, I expected that it will always return the same adapter, Use it to initialize.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -