I use Cursors
extensively in my app, to load and occasionally write information from and to a database. I have seen that Honeycomb and the Compatibility Package have new Loader
classes designed to help with loading data in a "good" way.
Essentially, are these new classes (in particular CursorLoader
) considerably better than previous methods of managing data? What is the benefit of a CursorLoader
over managed Cursors
for example?
And I use a ContentProvider
to deal with data, which obviously takes Uris
but how does this mesh with the initLoader()
method? Must I set up each of my Fragments
to use Loaders individually? And how unique does the id need to be for each loader, is it over the scope of my app or just a fragment? Is there any simple way of simply passing a Uri
to a CursorLoader to query my data?
All I can see at the moment is that Loaders add an unnecessary extra step to getting my data into my app, so can someone explain them to me better?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…