title: Do validation for email and mobile number for the same field(Edit Text) in android
body: <p>Do validation for email address and mobile number for the same field. I have only one edit text. This edit text needs to be validated for both email and mobile number. If the user inputs mobile number then proceed with mobile number validation, else if the user inputs email then proceed with email validation.</p>
  
  <pre><code>                    String EmailInputContent = emailInput.getText().toString();
                      // Toast.makeText(context, EmailInputContent, Toast.LENGTH_LONG).show();
  
  
                      String regexStr = "^[0-9]*$";
  
  
                      // Check for a valid email id.
                      if (TextUtils.isEmpty(EmailInputContent) ){
  
                          // Toast.makeText(context, " Enter the Email address  in forgot password", Toast.LENGTH_LONG).show();
  
                          // emailInput.setError("Enter the Emial address");
                          emailInput.setError("** Please enter the Email or Mobile number");
  
                          //entriesValid== false;
  
  
                          //emailInput.setError(getString(R.string.error_field_required));
  
                      }
                      else if(emailInput.getText().toString().trim().matches(regexStr)){
  
                      }
                      else if (!isEmailValid(EmailInputContent)) {
  
                          //  Toast.makeText(context, " Email address is invalid in forgot password", Toast.LENGTH_LONG).show();
  
                          emailInput.setError("Email address is invalid ");
                          //emailInput.setError(getString(R.string.error_invalid_email));
  
                      }
                      else
  
                      {
                          Intent i=new Intent(getApplication(),LoginActivity.class);
                          //Toast.makeText(getApplication(),"test",Toast.LENGTH_LONG).show();
                          ForgotPost("http://staging.rayaztech.com/flyonfly/app_forgotpassword");
                          startActivity(i);
                      }
  </code></pre>