public final class TaskManager
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
void |
addStatusListener(TaskListener theListener)
Adds a
TaskListener . |
Task |
getCurrentTask()
Returns an instance of the
Task the caller belongs to. |
Task |
getForegroundTask()
Returns foreground task info.
|
java.util.List<Task> |
getTaskList(boolean includeSystem)
Returns a list of running and paused tasks.
|
static TaskManager |
getTaskManager()
Returns
TaskManager . |
boolean |
pauseTask(Task task)
Pauses given
Task . |
void |
removeStatusListener(TaskListener theListener)
Removes a
TaskListener . |
boolean |
resumeTask(Task task)
Resumes given
Task . |
boolean |
setForegroundTask(Task task)
Assign foreground task.
|
boolean |
setPriority(Task task,
TaskPriority priority)
Changes priority for given
Task . |
Task |
startTask(Suite suite,
java.lang.String className)
|
boolean |
stopTask(Task task)
Stops given
Task . |
public static TaskManager getTaskManager() throws java.lang.SecurityException
TaskManager
.
To be able to retrieve the task manager caller application should
request javax.microedition.swm.SWMPermission("manageTask")
permission.TaskManager
.java.lang.SecurityException
- if the caller application is not "trusted"
or does not have the required javax.microedition.swm.SWMPermission
("manageTask")
permissionpublic Task getForegroundTask()
A task is said to be in the foreground if it is visible on the display and if user input device events will be delivered to it.
null
if there is no foreground
task.public java.util.List<Task> getTaskList(boolean includeSystem)
includeSystem
- indicates whether to include system task
into list.public Task getCurrentTask()
Task
the caller belongs to.Task
public Task startTask(Suite suite, java.lang.String className) throws java.lang.IllegalArgumentException
Task
from given Suite
.
Throws an exception if suite
is a library and can therefore
not be started.suite
- the suite to start the task fromclassName
- startup classTask
java.lang.IllegalArgumentException
- if the suite
argument is a
librarypublic boolean stopTask(Task task)
Task
.task
- the task to be stoppedtrue
if the task
was destroyedpublic boolean resumeTask(Task task)
Task
.
task
- the task to be resumedtask
was resumedpublic boolean pauseTask(Task task)
Task
.
task
- the task to be pausedtask
was pausedpublic boolean setForegroundTask(Task task)
A task is said to be in the foreground if it is visible on the display and if user input device events will be delivered to it.
task
- the task to become foreground tasktrue
if task
was assigned as foreground,
false
public boolean setPriority(Task task, TaskPriority priority) throws java.lang.IllegalArgumentException
Task
.task
- the task to change priority forpriority
- new priority, one of TaskPriority.TP_MAX
,
TaskPriority.TP_MIN
, or TaskPriority.TP_NORM
true
if priority has been changed successfully,
false
otherwisejava.lang.IllegalArgumentException
public void addStatusListener(TaskListener theListener)
TaskListener
. Several listeners can be added, each of them
will be notified about task status changes.theListener
- TaskListener
to be addedpublic void removeStatusListener(TaskListener theListener)
TaskListener
.theListener
- TaskListener
to be removedCopyright (c) 2013, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.