android annotations - How to cancel a @Background task with AndroidAnnotations -


my use case whenever user types edittext, input data used performing operations on background. these operations might take long enough cause anr. @textchange @background works fine if operation done quicly enough. operation takes long enough, user inputs more data, threading issues there multiple background tasks command update of same ui component.

i think achieve wanted behaviour asynctask api, wanted androidannotations based solutions well, simplifies code lot. great lib way.

below code snippets that'll illustrate point. @ least reading, comments/answers appreciated :)

@textchange void onuserinput(...) {   // start new thread on each text change event   // leading situation thread finishing   // last update ui   // operation time not fixed last event   // not necessary last thread finished   dooperation() }  @background void dooperation() {   // sleep simulate long taking operation   thread.sleep( 6000 );   updateui() }  @uithread void updateui() {   // update text field etc content based on operations } 

update: not possible @ moment, see days' answer below.

it's possible since aa 3.0. read thread.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -