Advertisement
wildanfuady

LoginActivity

Nov 24th, 2019
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. class LoginActivity : AppCompatActivity() {
  2.  
  3. override fun onCreate(savedInstanceState: Bundle?) {
  4. super.onCreate(savedInstanceState)
  5. setContentView(R.layout.activity_login)
  6. supportActionBar?.hide()
  7.  
  8. btn_login.setOnClickListener {
  9. login()
  10. }
  11. }
  12.  
  13. fun login() {
  14.  
  15. var username = text_username.text.toString()
  16. var password = text_password.text.toString()
  17.  
  18. if(username == "admin" && password == "admin"){
  19.  
  20. var intent = Intent(this, ListActivity::class.java)
  21. startActivity(intent)
  22. } else {
  23.  
  24. Toast.makeText(this, "This is a message displayed in a Toast", Toast.LENGTH_SHORT).show();
  25.  
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement