Guest User

Untitled

a guest
Feb 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. HashMap<String, String> map = new HashMap<>();
  2. map.put("key Name", getEditTextValue(define id));
  3.  
  4.  
  5. appDialogs.showProgressDialog();
  6.  
  7. callAPiActivity.doPost((Activity) mContext, map, Constant.URL, new GetApiResultJson() {
  8. @Override
  9. public void onSuccesResult(JSONObject result) throws JSONException {
  10. appDialogs.hideProgressDialog();
  11. JSONObject data = result.getJSONObject("details");
  12. User user = new User();
  13. user.setUser_id(data.getString("Key name"));
  14. prefrences.setUserData(user);
  15. appDialogs.setSuccessToast(result.optString("message"));
  16. Intent intent = new Intent(mContext, HomeWithViewPagerActivity.class);
  17. intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
  18. intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  19. startActivity(intent);
  20.  
  21. }
  22.  
  23. @Override
  24. public void onFailureResult(String messgae) throws JSONException {
  25. appDialogs.hideProgressDialog();
  26. appDialogs.setErrorToast(messgae);
  27. }
  28.  
  29. @Override
  30. public void onNetworkRetry(String messgae) throws JSONException {
  31.  
  32. }
  33. });
  34.  
  35. }
  36.  
  37. public boolean isValide() {
  38. String emailPattern = "^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$";
  39.  
  40. if (!edtEmail.getText().toString().matches(emailPattern)) {
  41. edtEmail.setError("Please enter a valid email address");
  42. return false;
  43. } else if (edtPassword.getText().toString().length() < 6) {
  44. edtPassword.setError("Password must be 6 character long");
  45. return false;
  46. }
  47. return true;
  48. }
Add Comment
Please, Sign In to add comment