O'Reilly logo

Hello, Android, 4th Edition by Ed Burnette

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Loaders

While you were coding the example in this chapter, you may have noticed warnings about managedQuery and the SimpleCursorAdapter constructor we were using being deprecated. They still work, and many examples you’ll find on the web still use them. But current versions of Android provide a much better way of doing long-running operations such as database queries: loaders.

Loaders are preferred for several reasons:

  • They provide asynchronous loading of data. managedQuery puts data loading in the UI thread, which can lead to pauses and stutters in the user interface.

  • They monitor the source of the data and deliver results as soon as they’re available, without requiring a requery.

  • They retain their data across configuration changes, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required