android - updating listview after inserting row via content provider -
I am using custom I have tried There is only one option I have seen This is my insert code I am including the log of the application and showing in the list view here is the code inside the content provider I think, you can see how it works, because it I had trouble like you and the problem was how I did it. It was exactly like this. ContentProvider to enter and query SQLite database in Android. When I query from the database, I am populating the data on the listview but this problem occurs when I include that row which I also want to update the list view. Custom Adapter is created by increasing
Cursor Adapter and
LoaderManager.Loader Callbacks
Context.getContentResolver (). Insert () function, I want to update listview
adapter.notifyDataSetChanged (); After adding the row, but the listview is not updating.
RestartLoader () Any other watt to update the list view?
context.getContentResolver (). Insert (ContentUris.withAppendedId (URI.) Expected word (column CONTENT_URI, Columns.INSERT_LOGS), column .LOGS), value);
If (rowId> 0) {Ury DartURI = Content uris With expected command (columncontronus, line id); Logs. E ("inserted", line ID + ""); . GetContext () getContentResolver () notifyChange (insertUri, tap). Return entry; }
Loader .
@ Override public empty onload loaded (loader & lt; cursor & gt; loader, cursor cursor) {... adapter.swap (cursor) data adapter. NotifyDataSetChanged (); listViewSetAdapter (dataAdapter); ...}
Comments
Post a Comment