Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void startClient()
- {
- Login = Fname.getText().toString().trim();
- Password = Lpass.getText().toString().trim();
- //clients = dbh.getAllClients();
- if (Login.length() == 0) {
- Toast.makeText(getApplicationContext(), "Enter Username", Toast.LENGTH_LONG).show();
- } else if (Password.length() == 0) {
- Toast.makeText(getApplicationContext(), "Enter password", Toast.LENGTH_LONG).show();
- } else {
- DBHelper db = new DBHelper(getApplicationContext());
- //get data from database
- final List<Client> user = db.getAllClients();
- String username = Login;
- String password = Password;
- if (username.equals(user.get(0).getFirst()) && password.equals(user.get(0).getPassword())) {
- Intent i = new Intent(getApplicationContext(), Client.class);
- startActivity(i);
- } else if (username.equals(user.get(0).getFirst()) && !password.equals(user.get(0).getPassword())) {
- Password.equals("");
- Toast.makeText(MainActivity.this, "Wrong Password", Toast.LENGTH_SHORT).show();
- } else if (!username.equals(user.get(0).getFirst())) {
- Toast.makeText(MainActivity.this, "Wrong Username", Toast.LENGTH_SHORT).show();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement