Skip to content

Instantly share code, notes, and snippets.

@aasumitro
Created December 31, 2017 06:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aasumitro/098b326820d5f1cefe3d72bda0995dee to your computer and use it in GitHub Desktop.
Save aasumitro/098b326820d5f1cefe3d72bda0995dee to your computer and use it in GitHub Desktop.
Thread
//Do thread
val background = object : Thread() {
override fun run() {
try {
// Thread will sleep for 2 seconds
sleep((2 * 1000).toLong())
openMainActivity()
finish()
} catch (e: Exception) {
//Print error in logcat (development requirement)
e.printStackTrace()
}
}
}
// start thread
background.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment