Advertisement
Guest User

Untitled

a guest
Oct 6th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. package com.android;
  2.  
  3. import android.app.Activity;
  4. import android.content.Intent;
  5. import android.os.Bundle;
  6. import android.view.View;
  7. import android.view.View.OnClickListener;
  8. import android.widget.Button;
  9. import android.widget.EditText;
  10. import android.widget.Toast;
  11.  
  12. public class Register extends Activity{
  13. //for the registration screen
  14. DBHandler db;
  15. EditText username, password, name;
  16. Button save;
  17.  
  18. public class Save implements OnClickListener {
  19.  
  20. public void onClick(View v) {
  21. // TODO Auto-generated method stub
  22. if(v == save){
  23. User us = new User();
  24. us.setUsername(username.getText().toString());
  25. us.setPassword(password.getText().toString());
  26. us.setName(name.getText().toString());
  27. db.add(us);
  28. /*String uname = us.setUsername(username.getText().toString());
  29. String name = us.setPassword(password.getText().toString());
  30. String pass = us.setName(password.getText().toString());
  31. Boolean check = db.add(uname,pass,name);*/
  32. Toast.makeText(Register.this, "Registered", Toast.LENGTH_LONG);
  33. Intent i = new Intent(Register.this, ThreeByThree.class );
  34. startActivity(i);
  35.  
  36. }
  37.  
  38. }
  39.  
  40. }
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48. @Override
  49. protected void onCreate(Bundle savedInstanceState) {
  50. super.onCreate(savedInstanceState);
  51. setContentView(R.layout.register);
  52.  
  53. username = (EditText) findViewById (R.id.editText1);
  54. password = (EditText) findViewById (R.id.editText2);
  55. name = (EditText) findViewById (R.id.editText3);
  56. save = (Button) findViewById (R.id.btnsave);
  57. save.setOnClickListener(new Save());
  58.  
  59.  
  60. }
  61.  
  62.  
  63.  
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement