Guest User

Untitled

a guest
Jan 15th, 2019
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. public void onClick(View v) {
  2. String username=akun.getText().toString();
  3. String password1=password.getText().toString();
  4.  
  5. try{
  6. if(username.length() > 0 && password1.length() >0)
  7. {
  8. Toko dbUser = new Toko();
  9. dbUser.open();
  10.  
  11. if(dbUser.Login(akun, password))
  12. {
  13. Toast.makeText(LoginForm.this, "Success !",Toast.LENGTH_LONG).show();
  14. }
  15. else
  16. Toast.makeText(LoginForm.this, "cok !",Toast.LENGTH_LONG).show();
  17. //dbUser.close();
  18. }
  19.  
  20. }catch(Exception e)
  21. {
  22. Toast.makeText(LoginForm.this,"cok ! 2", Toast.LENGTH_LONG).show();
  23. }
  24. }
  25.  
  26. public boolean Login(String akun, String password) throws SQLException
  27. {
  28. Cursor C = db.rawQuery("SELECT * FROM toko WHERE akun=? AND password=?",new String[] {akun, password});
  29. if (C != null) {
  30. if(C.getCount() > 0)
  31. {
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37.  
  38. if(dbUser.**Login**(akun, password))
  39.  
  40. public boolean Login(**String akun, String password**) throws SQLException
  41. {
  42. Cursor C = db.rawQuery("SELECT * FROM toko WHERE akun=? AND password=?",new >String[] {akun, password});
  43. if (C != null) {
  44. if(C.getCount() > 0)
  45. {
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51.  
  52. if(dbUser.Login(akun, password))
  53.  
  54. if(dbUser.Login(username, password1))
Add Comment
Please, Sign In to add comment