Question

Why do we use restartLoader(), if loader already implicitly listens to any updations in the database? Do we use it to reuse the same loader to send a different query?

Was it helpful?

Solution

Because sometimes you might want to change your where condition in your query. You can call restartLoader and pass your where condition in the Bundle argument. restartLoader will call initLoader again and create a new cursorloader with the new where condition. If you don't call restartLoader, you can not change the where condition in your query.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top