Created
May 17, 2019 08:29
-
-
Save natiginfo/2d2ad248aed18a1abb850989f733e580 to your computer and use it in GitHub Desktop.
Main thread executor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.Handler | |
import android.os.Looper | |
import java.util.concurrent.Executor | |
class MainThreadExecutor : Executor { | |
private val mainThreadHandler = Handler(Looper.getMainLooper()) | |
override fun execute(command: Runnable) { | |
mainThreadHandler.post(command) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment