10

Does anyone have a description of the usage of the Bundle args parameter of initLoader()? Is the object merely set on the resulting cursor or is there a way to get access to that object from the data source being queried - like a Content Provider?

from docs:

args Optional arguments to supply to the loader at construction. If a loader already exists (a new one does not need to be created), this parameter will be ignored and the last arguments continue to be used.

Thank you in advance.

user1080691
  • 133
  • 1
  • 8

1 Answers1

13

The Bundle args parameter of initLoader() and resetLoader() is used to pass extra information to onCreateLoader(int id, Bundle args). This can be useful to give selection arguments to queries, for instance.

ptc
  • 546
  • 6
  • 9
  • 1
    Be wary of using anything that can change the dataset in that bundle, since it can be ignored you open yourself up to seeing stale data – smith324 Mar 03 '14 at 02:58
  • 1
    @smith324 that's fine as long as you're aware of it and use the appropriate methods to handle the situation, e.g. `restartLoader`. – TWiStErRob Jun 05 '15 at 21:09