Skip to content

Instantly share code, notes, and snippets.

@gcherubini
Last active October 3, 2017 21:14
Show Gist options
  • Save gcherubini/7a81c2efb02a7a537087f276b0df44eb to your computer and use it in GitHub Desktop.
Save gcherubini/7a81c2efb02a7a537087f276b0df44eb to your computer and use it in GitHub Desktop.
class HomeActivity : AppCompatActivity() {
private val USER_NAME = "Albert Eisten"
private val TIMER_SECONDS = 5
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val binding: ActivityHomeBinding = DataBindingUtil.setContentView(this, R.layout.activity_home)
val user = User(USER_NAME)
binding.setVariable(BR.user, user)
binding.executePendingBindings()
showDialogWhenTimerFinishes()
}
private fun showDialogWhenTimerFinishes() {
val handler = Handler()
handler.postDelayed({
showAlertDialog("Press OK and move to next View", DialogInterface.OnClickListener {
_, _ -> moveForward(ListActivity())
})
}, (TIMER_SECONDS * 1000).toLong())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment