Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Threading cancelling #478

Description

@melnikovdv

Hi. Yesterday I asked at google groups about thread cancelling in AndroidAnnotations. And Mathieu adviced me to explan this feature in issue.

It' really cool to use @background and @UIView instead of AsyncTask. But not all features of AsyncTask are covered. In our project we have a lot of code, that uses its cancel feature (onCancelled()).
Let me show you couple of most common cases:

  • Sometimes we run ProgressDialog, while retrieving information from internet, and when user cancels this dialog we want to dismiss it and finish the whole activity. I saw many cases of such behaviour in other apps on GitHub
  • Sometimes background task should be stopped and runned again with new parameters, that occured somehow.

It would be really useful to have such feature of cancelling background tasks. Don't you think so?

Activity

  1. pyricau commented on Feb 27, 2013

    @pyricau
    Contributor

    FYI canceling an asynctask doesn't stop the background thread from running, you have to check the cancel status from the background code. You could probably reproduce that kind of behavior with AndroidAnnotations.

    The way @Background is designed doesn't allow easy message sending to interrupt. You could use a shared queue as an inbox to get exchange messages between threads.

    If you can think of a nice way to cancel @Background task, please let us know and reopen this issue. I'm closing it for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions