I'm writing an AsyncTaskLoader for Android, and I'm wondering - should the caller (who presumably set everything up using a LoaderManager) expect me to call onLoadFinished with a full set of results each time, or can I simply return new results on every subsequent change?

Thanks!

EDIT

Put another way:

Let's say that I'm monitoring some data source, and during the first load, it returns A B C. Then, later, D and E become available. Do I return D E, or do I return A B C D E

有帮助吗?

解决方案

usually i use a loader to load a cursor => cursorloader, the cursor will always contain all data that fits its conditions. It doesnt distinguish between first and second time running, as it will everytime return anything there is.

in your case a b c d e

update

as i said im using this with a cursorloader to pull data from a db and pass it to a listview, you will have to implement a cursoradapter to display the Data from the DB.

There wont be any jitter, but you might want to think of some sort of animation while binding the data to the view, since it will pop up once its fully loaded(i dont know if you meant that by jitter).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top