AI2 Component
(Version nb184)
AsynchUtil.java
Go to the documentation of this file.
1
// -*- mode: java; c-basic-offset: 2; -*-
2
// Copyright 2009-2011 Google, All Rights reserved
3
// Copyright 2011-2012 MIT, All rights reserved
4
// Released under the Apache License, Version 2.0
5
// http://www.apache.org/licenses/LICENSE-2.0
6
7
package
com.google.appinventor.components.runtime.util;
8
9
import
android.os.Handler;
10
17
public
class
AsynchUtil
{
18
23
public
static
void
runAsynchronously
(
final
Runnable call) {
24
Thread thread =
new
Thread(call);
25
thread.start();
26
}
34
public
static
void
runAsynchronously
(
final
Handler androidUIHandler,
35
final
Runnable call,
36
final
Runnable callback) {
37
Runnable runnable =
new
Runnable() {
38
public
void
run() {
39
call.run();
40
if
(callback !=
null
) {
41
androidUIHandler.post(
new
Runnable() {
42
public
void
run() {
43
callback.run();
44
}
45
});
46
}
47
}
48
};
49
Thread thread =
new
Thread(runnable);
50
thread.start();
51
}
52
}
com.google.appinventor.components.runtime.util.AsynchUtil.runAsynchronously
static void runAsynchronously(final Runnable call)
Definition:
AsynchUtil.java:23
com.google.appinventor.components.runtime.util.AsynchUtil
Definition:
AsynchUtil.java:17
com.google.appinventor.components.runtime.util.AsynchUtil.runAsynchronously
static void runAsynchronously(final Handler androidUIHandler, final Runnable call, final Runnable callback)
Definition:
AsynchUtil.java:34
com
google
appinventor
components
runtime
util
AsynchUtil.java
Generated by
1.8.16