Skip to content

Instantly share code, notes, and snippets.

@umarov
Created January 25, 2018 23:22
Show Gist options
  • Save umarov/31b29bd3e239906ec6849c1541822312 to your computer and use it in GitHub Desktop.
Save umarov/31b29bd3e239906ec6849c1541822312 to your computer and use it in GitHub Desktop.
inline fun createTodoList(name: String, crossinline afterCreate: (todoList: TodoList) -> Unit) {
Thread(Runnable {
val todoList = TodoList(name)
db.todoListDao().insertTodoList(todoList)
Handler(Looper.getMainLooper()).post { afterCreate(todoList) }
}).start()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment