blob: 577409091c08a2bce352b0d630e64d94546d2ca8 [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package io.v.android;
import android.os.Handler;
import android.os.Looper;
import java.util.concurrent.Executor;
/**
* Executor that executes all of its commands on the Android UI thread.
*/
public class UiThreadExecutor implements Executor {
/**
* Singleton instance of the UiThreadExecutor.
*/
public static final UiThreadExecutor INSTANCE = new UiThreadExecutor();
private final Handler handler = new Handler(Looper.getMainLooper());
@Override
public void execute(Runnable runnable) {
handler.post(runnable);
}
private UiThreadExecutor() {}
}