Guest User

Untitled

a guest
Dec 29th, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1. protected void onCreate(Bundle savedInstanceState) {
  2. super.onCreate(savedInstanceState);
  3. setContentView(R.layout.activity_main2);
  4. signupnow=(Button) findViewById(R.id.button3);
  5.  
  6. signupnow.setOnClickListener(new View.OnClickListener() {
  7. @Override
  8. public void onClick(View v) {
  9.  
  10. Toast.makeText(Main2Activity.this,"passed test1", Toast.LENGTH_LONG).show();
  11. nametext = (EditText) findViewById(R.id.editText4);
  12. emailtext = (EditText) findViewById(R.id.editText);
  13. passtext = (EditText) findViewById(R.id.editText2);
  14. // no we have the input check the Email if its cottect or not
  15. Toast.makeText(Main2Activity.this,"passed test2 text getters", Toast.LENGTH_LONG).show();
  16.  
  17. db = new DatabaseHelper1(getApplicationContext());
  18.  
  19. sessiondb=new logindatabase(getApplicationContext());
  20. Toast.makeText(Main2Activity.this,"passed test3 database connections ", Toast.LENGTH_LONG).show();
  21.  
  22.  
  23. String Email = emailtext.getText().toString();
  24. String name = nametext.getText().toString();
  25. String pass = passtext.getText().toString();
  26. Toast.makeText(Main2Activity.this,Email+"--"+pass+"---"+name,
  27. Toast.LENGTH_LONG).show();
  28. Boolean Emailstat=false;
  29.  
  30. if (Email != null && name != null && pass != null) {
  31.  
  32. Toast.makeText(Main2Activity.this,"passed test4 checking emails ", Toast.LENGTH_LONG).show();
  33.  
  34. if (Email.contains("@yahoo.com") || Email.contains("@gmail.com") || Email.contains("@hotmail.com")) {
  35. Emailstat=true;
  36. }
  37.  
  38.  
  39.  
  40.  
  41. if(Emailstat==true)
  42. {
  43.  
  44. int emailsignupstat=db.CheckSiqnupEmail(Email);
  45.  
  46. if(emailsignupstat==0)
  47. {
  48.  
  49. db.addData(Email,pass,name);
  50. // login database to add user as loged in
  51.  
  52. sessiondb.addData(Email,pass);
  53.  
  54. Intent gotoprofile=new Intent(getApplicationContext(),Main3Activity.class);
  55.  
  56. startActivity(gotoprofile);
  57.  
  58.  
  59. }
  60. else
  61. {
  62. Toast.makeText(Main2Activity.this, "Email is Used
  63. Before ", Toast.LENGTH_LONG).show();
  64. emailtext.setText("");
  65. passtext.setText("");
  66. nametext.setText("");
  67.  
  68.  
  69. }
  70.  
  71.  
  72.  
  73.  
  74.  
  75. }
  76. else
  77. {
  78. Toast.makeText(Main2Activity.this, "Wrong Email ", Toast.LENGTH_LONG).show();
  79. emailtext.setText("");
  80. passtext.setText("");
  81. nametext.setText("");
  82.  
  83. }
  84.  
  85.  
  86. }
  87. }
  88.  
  89. });
  90.  
  91. }
Add Comment
Please, Sign In to add comment