Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Maybe you should consider reviewing your approach, the need you have for performing several updates depending on the view and cancel all the pending tasks from the previous views gives the impression that you are performing the load of data individually for every view that needs to be created.</p> <p>In a list view with a list adapter, the usual approach is to load a portion of the data (either as list of ValueObject or as Cursor from multiple database rows) paginated on demand or in one goal, not item by item. So if you wish to update the next page, you basically perform one single operation, either using AsyncTask or Loaders to fetch the new items to the model then making it available for the UI to display them. This way, you will be applying MVC, and you won't have several pending tasks to cancel and control, and your structure would be more solid and easier to manage.</p> <p>About the alternatives, If you're dealing with database, the most straightforward way is to use the CursorLoader, i.e. the <a href="https://developer.android.com/reference/android/content/Loader.html" rel="nofollow">loaders</a> instead of <a href="https://developer.android.com/reference/android/os/AsyncTask.html" rel="nofollow">AsyncTask</a>, but if you're dealing with data that comes from the network or filesystem, you're kinda free to choose from the variety of other options available. <a href="https://developer.android.com/reference/android/os/AsyncTask.html" rel="nofollow">AsyncTask</a> is much more simpler to use, mostly recommended for simple things or one shot queries. But you can also use Loaders for such tasks as well, see <a href="https://developer.android.com/reference/android/content/AsyncTaskLoader.html" rel="nofollow">AsyncTaskLoader</a>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload