本文整理了Java中android.os.Handler.post()
方法的一些代码示例,展示了Handler.post()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Handler.post()
方法的具体详情如下:
包路径:android.os.Handler
类名称:Handler
方法名:post
暂无
代码示例来源:origin: square/retrofit
@Override public void execute(Runnable r) {
handler.post(r);
}
}
代码示例来源:origin: libgdx/libgdx
@Override
public void exit () {
handler.post(new Runnable() {
@Override
public void run () {
callbacks.exit();
}
});
}
代码示例来源:origin: libgdx/libgdx
@Override
public void exit () {
handler.post(new Runnable() {
@Override
public void run () {
callbacks.exit();
}
});
}
代码示例来源:origin: libgdx/libgdx
@Override
public void exit () {
handler.post(new Runnable() {
@Override
public void run () {
AndroidApplication.this.finish();
}
});
}
代码示例来源:origin: libgdx/libgdx
@Override
public void exit () {
handler.post(new Runnable() {
@Override
public void run () {
AndroidDaydream.this.finish();
}
});
}
代码示例来源:origin: libgdx/libgdx
@Override
public void exit () {
handler.post(new Runnable() {
@Override
public void run () {
AndroidApplication.this.finish();
}
});
}
代码示例来源:origin: libgdx/libgdx
@Override
public void exit () {
handler.post(new Runnable() {
@Override
public void run () {
AndroidDaydream.this.finish();
}
});
}
代码示例来源:origin: square/leakcanary
private void postWaitForIdle(final Retryable retryable, final int failedAttempts) {
mainHandler.post(new Runnable() {
@Override public void run() {
waitForIdle(retryable, failedAttempts);
}
});
}
代码示例来源:origin: square/leakcanary
private void cancelToast(final Toast toast) {
if (toast == null) {
return;
}
mainHandler.post(new Runnable() {
@Override public void run() {
toast.cancel();
}
});
}
}
代码示例来源:origin: libgdx/libgdx
@Override
public void setOnscreenKeyboardVisible (final boolean visible) {
handle.post(new Runnable() {
public void run () {
InputMethodManager manager = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
if (visible) {
View view = ((AndroidGraphics)app.getGraphics()).getView();
view.setFocusable(true);
view.setFocusableInTouchMode(true);
manager.showSoftInput(((AndroidGraphics)app.getGraphics()).getView(), 0);
} else {
manager.hideSoftInputFromWindow(((AndroidGraphics)app.getGraphics()).getView().getWindowToken(), 0);
}
}
});
}
代码示例来源:origin: libgdx/libgdx
@Override
public void setOnscreenKeyboardVisible (final boolean visible) {
handle.post(new Runnable() {
public void run () {
InputMethodManager manager = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
if (visible) {
View view = ((AndroidGraphics)app.getGraphics()).getView();
view.setFocusable(true);
view.setFocusableInTouchMode(true);
manager.showSoftInput(((AndroidGraphics)app.getGraphics()).getView(), 0);
} else {
manager.hideSoftInputFromWindow(((AndroidGraphics)app.getGraphics()).getView().getWindowToken(), 0);
}
}
});
}
代码示例来源:origin: bumptech/glide
@Override
public void execute(@NonNull Runnable command) {
handler.post(command);
}
};
代码示例来源:origin: libgdx/libgdx
@Override
public void runOnUiThread (Runnable runnable) {
if (Looper.myLooper() != Looper.getMainLooper()) {
// The current thread is not the UI thread.
// Let's post the runnable to the event queue of the UI thread.
new Handler(Looper.getMainLooper()).post(runnable);
} else {
// The current thread is the UI thread already.
// Let's execute the runnable immediately.
runnable.run();
}
}
代码示例来源:origin: libgdx/libgdx
@Override
public void runOnUiThread (Runnable runnable) {
if (Looper.myLooper() != Looper.getMainLooper()) {
// The current thread is not the UI thread.
// Let's post the runnable to the event queue of the UI thread.
new Handler(Looper.getMainLooper()).post(runnable);
} else {
// The current thread is the UI thread already.
// Let's execute the runnable immediately.
runnable.run();
}
}
代码示例来源:origin: libgdx/libgdx
@Override
public void runOnUiThread (Runnable runnable) {
if (Looper.myLooper() != Looper.getMainLooper()) {
// The current thread is not the UI thread.
// Let's post the runnable to the event queue of the UI thread.
new Handler(Looper.getMainLooper()).post(runnable);
} else {
// The current thread is the UI thread already.
// Let's execute the runnable immediately.
runnable.run();
}
}
代码示例来源:origin: libgdx/libgdx
@Override
public void runOnUiThread (Runnable runnable) {
if (Looper.myLooper() != Looper.getMainLooper()) {
// The current thread is not the UI thread.
// Let's post the runnable to the event queue of the UI thread.
new Handler(Looper.getMainLooper()).post(runnable);
} else {
// The current thread is the UI thread already.
// Let's execute the runnable immediately.
runnable.run();
}
}
代码示例来源:origin: libgdx/libgdx
@Override
public void onSystemUiVisibilityChange (int arg0) {
application.getHandler().post(new Runnable() {
@Override
public void run () {
application.useImmersiveMode(true);
}
});
}
});
代码示例来源:origin: libgdx/libgdx
@Override
public void onSystemUiVisibilityChange (int arg0) {
application.getHandler().post(new Runnable() {
@Override
public void run () {
application.useImmersiveMode(true);
}
});
}
});
代码示例来源:origin: nostra13/Android-Universal-Image-Loader
static void runTask(Runnable r, boolean sync, Handler handler, ImageLoaderEngine engine) {
if (sync) {
r.run();
} else if (handler == null) {
engine.fireCallback(r);
} else {
handler.post(r);
}
}
代码示例来源:origin: greenrobot/EventBus
protected void waitForHandler(Handler handler) {
final CountDownLatch doneLatch = new CountDownLatch(1);
handler.post(new Runnable() {
@Override
public void run() {
doneLatch.countDown();
}
});
awaitLatch(doneLatch, 10);
}
内容来源于网络,如有侵权,请联系作者删除!