public static boolean isNotNull(String txt){ return txt!=null && txt.trim().length()>0 ? true: false; }public boolean isEmailEmpty(String lusername) { boolean status; if (Utility.isNotNull(lusername)) { status = true; } else { status = false; textt.setText("Email cannot be empty"); toastt.setView(layoutt); toastt.show(); } return status; } public boolean isEmailValid(String lusername) { boolean status; if (Utility.validateEmail(lusername)){ status = true; } else { status = false; textt.setText("Invalid email address"); toastt.setView(layoutt); toastt.show(); } return status; }public boolean isPasswordhaveSixDigits(String pass) { boolean status; if (pass.length() > 7) { status = true; } else { status = false; textt.setText("Invalid Password"); toastt.setView(layoutt); toastt.show(); } return status; } public boolean isPasswordEmpty(String pass) { boolean status; if (Utility.isNotNull(pass)) { status = true; } else { status = false; textt.setText("Password cannot be empty"); toastt.setView(layoutt); toastt.show(); } return status; }===============================Call the Service Method...lusername = txtEmail.getText().toString(); lpassword = txtPassword.getText().toString(); if (isEmailEmpty(lusername) && isEmailValid(lusername) && isPasswordEmpty(lpassword) && isPasswordhaveSixDigits(lpassword)){ loginUserOnline(lusername, lpassword); } else { System.out.println("4"); }
Tuesday, January 31, 2017
Feild Validation in Android
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment