Skip to content

Instantly share code, notes, and snippets.

@BALUSANGEM
Created February 6, 2018 09:32
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 BALUSANGEM/4b6c2d37b6b64a81e3f3a69f075110f1 to your computer and use it in GitHub Desktop.
Save BALUSANGEM/4b6c2d37b6b64a81e3f3a69f075110f1 to your computer and use it in GitHub Desktop.
class LoginActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_login)
goto_main_screen_button.setOnClickListener {
gotoMainScreen()
}
}
private fun gotoMainScreen() {
val intent = Intent(this, MainActivity::class.java)
startActivity(intent)
finish()
}
}
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
goto_password_screen_button.setOnClickListener {
gotoPasswordScreen()
}
}
private fun gotoPasswordScreen() {
val intent = Intent(this, PasswordActivity::class.java)
startActivity(intent)
}
}
class PasswordActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_password)
goto_login_screen_button.setOnClickListener {
gotoLoginScreen()
}
}
private fun gotoLoginScreen() {
val intent = Intent(this, LoginActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK
startActivity(intent)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment