I was going through some of my code and I realized I don't actually know how a CursorLoader
and LoaderManager
combination used with a CursorAdapter
connect. Heres the part that I am confused in.
agendaAdapter = new MyAgendaAdapter(this, null);
makeProviderBundle(new String[] {"_id", "event_name", "start_date", "start_time",
"end_date", "end_time", "location"}, "date(?) >= start_date and date(?) <= end_date",
new String[]{getChosenDate(), getChosenDate()}, null);
getLoaderManager().initLoader(0, myBundle, MainDisplayActivity.this);
list.setAdapter(agendaAdapter);
So how does the query()
method from my custom ContentProvider
know to send it to that specific CursorAdapter
? I just don't see the connection. I understand everything else in that but what this question is on. Oh and I should mention, the code works fine.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…