Advertisement
Guest User

Login

a guest
Apr 4th, 2018
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. package com.example.petrus.loginregister;
  2.  
  3. import android.database.sqlite.SQLiteDatabase;
  4. import android.content.Intent;
  5. import android.support.v7.app.AppCompatActivity;
  6. import android.os.Bundle;
  7. import android.view.View;
  8. import android.widget.Button;
  9. import android.widget.EditText;
  10. import android.widget.TextView;
  11. import android.widget.Toast;
  12.  
  13. import java.security.Key;
  14. import java.util.ArrayList;
  15. import java.util.List;
  16.  
  17. public class LoginActivity extends AppCompatActivity {
  18.  
  19. DataHelper dbHelper;
  20. Button btnA;
  21. Button btnB;
  22. EditText editA;
  23. EditText editB;
  24. View viewA;
  25. TextView txtA;
  26. TextView txtB;
  27. TextView txtC;
  28. String username;
  29. String password;
  30.  
  31.  
  32. @Override
  33. protected void onCreate(Bundle savedInstanceState) {
  34. super.onCreate(savedInstanceState);
  35. setContentView(R.layout.login);
  36. dbHelper = new DataHelper(this);
  37. btnA = findViewById(R.id.btn_login);
  38. btnB = findViewById(R.id.btn_register);
  39. editA = findViewById(R.id.txt_username);
  40. editB = findViewById(R.id.txt_password);
  41. viewA = findViewById(R.id.View1);
  42. txtA = findViewById(R.id.TextView1);
  43. txtB = findViewById(R.id.TextView2);
  44. txtC = findViewById(R.id.TextView3);
  45.  
  46. btnA.setOnClickListener(new View.OnClickListener() {
  47. @Override
  48. public void onClick(View view) {
  49. username = editA.getText().toString();
  50. password = editB.getText().toString();
  51. List daftar = new ArrayList();
  52. Intent i = new Intent(getApplicationContext(),DashboardActivity.class);
  53. startActivity(i);
  54.  
  55. }
  56.  
  57. });
  58.  
  59. btnB.setOnClickListener(new View.OnClickListener() {
  60. @Override
  61. public void onClick(View view) {
  62. Intent i = new Intent(getApplicationContext(),RegisterActivity.class);
  63. startActivity(i);
  64. }
  65. });
  66.  
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement