Skip to content

cleverua/blackberry_async_task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DESCRIPTION

This sample Blackberry application demonstrates an approach for long running background tasks management, such tasks can perform an http request, process some calculations etc. While the task is running it displays a simple progress dialog screen that has ‘Cancel’ button - which (surprisingly) cancels the task.

USAGE

Define the task class, should extend RunnableTask

public class MyTask extends RunnableTask {
  ...
}

Initialize it by defining the following four Actions:

  • jobAction - incapsulates the task logic itself (a long http request for instance)

  • successAction - this action will be executed when the jobAction finished successfully

  • cancelAction - this atcion will be executed if the jobAction was interrupted by user

  • failureAction - this atcion will be called when it jobAction throws an exception during its run

    public class MyTask extends RunnableTask {

    public MyTask() {
      setJobAction(new Action() {...} );
      setSuccessAction(new Action() {...} );
      setCancelAction(new Action() {...} );
      setFailureAction(new Action() {...} );
    }

    }

Launch it

new MyTask().process('Please wait...');

This line of code will launch the jobAction in background while a progress dialog is on top. User would be able to cancel it using a button on the progress dialog

EXAMPLES

To see a couple of examples please launch AsyncTaskApplication (com.cleverua.bb.example) in BlackBerry device simulator.

About

An asynchronous tasks framework for Java BlackBerry development. Allows to perform background operations under a progress popup. Supports cancellable tasks out of the box.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages