I use CursorLoader in my App, to do DB transactions.
My app also has the method calling startManagingCursor(), which is deprecated.
I just want to replace this method calling, so what am I supposed to do ?
startManagingCursor does not retain the Cursor's state across configuration changes. Instead, each time the Activity is destroyed due to a configuration change (a simple orientation change, for example), the Cursor is destroyed and must be requeried.
A CursorLoader is a specialized member of Android's loader framework specifically designed to handle cursors. In a typical implementation, a CursorLoader uses a ContentProvider to run a query against a database, then returns the cursor produced from the ContentProvider back to an activity or fragment.
This class was deprecated in API level 28.
notifyChange(insertedId, null);
startManagingCursor()
is deprecated because it does operations on the main thread which can freeze up the UI and deliver a poor user experience. You should use a CusrorLoader with a LoaderManager instead. Check out this tutorial series from Alex Lockwood
for detailed instructions:.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With