Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. EditText password;
  2. TextView tvusername;
  3. Button signIn;
  4. SQLiteDatabase db=null;
  5. @Override
  6. protected void onCreate(Bundle savedInstanceState) {
  7. super.onCreate(savedInstanceState);
  8. setContentView(R.layout.log_in);
  9. db = openOrCreateDatabase("mydb", MODE_PRIVATE, null);
  10.  
  11. tvusername = (TextView) findViewById(R.id.tfuser);
  12. password = (EditText) findViewById(R.id.etMpinnumber);
  13. signIn = (Button) findViewById(R.id.btnlogin);
  14. db.execSQL("create table if not exists login(firstname varchar, lastname varchar, email varchar, mobile varchar, dob varchar, password varchar)");
  15.  
  16. Cursor s = db.rawQuery("select firstname +' '+lastname AS username from login", null);
  17. s.moveToFirst();
  18. if(s.getCount()>0){
  19. tvusername.setText(s.getString(s.getColumnIndex("username")));
  20. }
  21. else{
  22. Intent i=new Intent("com.tubotechno.SignUp");
  23. startActivity(i);
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement