Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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