Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EditText password;
- TextView tvusername;
- Button signIn;
- SQLiteDatabase db=null;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.log_in);
- db = openOrCreateDatabase("mydb", MODE_PRIVATE, null);
- tvusername = (TextView) findViewById(R.id.tfuser);
- password = (EditText) findViewById(R.id.etMpinnumber);
- signIn = (Button) findViewById(R.id.btnlogin);
- db.execSQL("create table if not exists login(firstname varchar, lastname varchar, email varchar, mobile varchar, dob varchar, password varchar)");
- Cursor s = db.rawQuery("select firstname +' '+lastname AS username from login", null);
- s.moveToFirst();
- if(s.getCount()>0){
- tvusername.setText(s.getString(s.getColumnIndex("username")));
- }
- else{
- Intent i=new Intent("com.tubotechno.SignUp");
- startActivity(i);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement