Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main2);
- signupnow=(Button) findViewById(R.id.button3);
- signupnow.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Toast.makeText(Main2Activity.this,"passed test1", Toast.LENGTH_LONG).show();
- nametext = (EditText) findViewById(R.id.editText4);
- emailtext = (EditText) findViewById(R.id.editText);
- passtext = (EditText) findViewById(R.id.editText2);
- // no we have the input check the Email if its cottect or not
- Toast.makeText(Main2Activity.this,"passed test2 text getters", Toast.LENGTH_LONG).show();
- db = new DatabaseHelper1(getApplicationContext());
- sessiondb=new logindatabase(getApplicationContext());
- Toast.makeText(Main2Activity.this,"passed test3 database connections ", Toast.LENGTH_LONG).show();
- String Email = emailtext.getText().toString();
- String name = nametext.getText().toString();
- String pass = passtext.getText().toString();
- Toast.makeText(Main2Activity.this,Email+"--"+pass+"---"+name,
- Toast.LENGTH_LONG).show();
- Boolean Emailstat=false;
- if (Email != null && name != null && pass != null) {
- Toast.makeText(Main2Activity.this,"passed test4 checking emails ", Toast.LENGTH_LONG).show();
- if (Email.contains("@yahoo.com") || Email.contains("@gmail.com") || Email.contains("@hotmail.com")) {
- Emailstat=true;
- }
- if(Emailstat==true)
- {
- int emailsignupstat=db.CheckSiqnupEmail(Email);
- if(emailsignupstat==0)
- {
- db.addData(Email,pass,name);
- // login database to add user as loged in
- sessiondb.addData(Email,pass);
- Intent gotoprofile=new Intent(getApplicationContext(),Main3Activity.class);
- startActivity(gotoprofile);
- }
- else
- {
- Toast.makeText(Main2Activity.this, "Email is Used
- Before ", Toast.LENGTH_LONG).show();
- emailtext.setText("");
- passtext.setText("");
- nametext.setText("");
- }
- }
- else
- {
- Toast.makeText(Main2Activity.this, "Wrong Email ", Toast.LENGTH_LONG).show();
- emailtext.setText("");
- passtext.setText("");
- nametext.setText("");
- }
- }
- }
- });
- }
Add Comment
Please, Sign In to add comment