title: How to validation login in android project?
body: <p>I have developed one login form in Android. I have to implement validation part to my login class.  This is my login class. I'm using api for connect the db. Please help me this.</p>
  
  <p>public class LoginActivity extends AppCompatActivity {</p>
  
  <pre><code>private static final int REQUEST_READ_CONTACTS = 0;
  SoapPrimitive resultString;
  String Response;
  String url = "url";
  
  private EditText usernamee;
  private EditText passwordd;
  private View mLoginFormView;
  String username = "";
  String password = "";
  String response = "";
  private String count = "";
  
  JSONArray LocArray = new JSONArray();
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_login);
  
      final Context context = getApplicationContext();
      // Set up the login form.
      usernamee = (EditText) findViewById(R.id.usernamee);
      passwordd = (EditText) findViewById(R.id.passwordd);
  
      Button mEmailSignInButton = (Button) findViewById(R.id.btnLogin);
  
      mEmailSignInButton.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              username = usernamee.getText().toString();
              password = passwordd.getText().toString();
  
              RequestQueue queue = Volley.newRequestQueue(context);
  
              StringRequest postRequest = new StringRequest(Request.Method.POST, url,
                      new Response.Listener&lt;String&gt;()
                      {
                          @Override
                          public void onResponse(String response) {
                              // response
                              Log.d("Response", response);
  
                              try {
                                  JSONObject obj = new JSONObject(response);
                                  if(obj.get("Role").equals("Admin"))
                                  {
                                      Intent adminIntent = new Intent(LoginActivity.this, Main2Activity.class);
                                      startActivity(adminIntent);
                                  }
                                  else if (obj.get("Role").equals("User"))
                                  {
                                      Intent userIntent = new Intent(LoginActivity.this, Main3Activity.class);
                                      startActivity(userIntent);
                                  }
                              } catch (JSONException e) {
                                  e.printStackTrace();
                              }
                          }
                      },
                      new Response.ErrorListener()
                      {
                          @Override
                          public void onErrorResponse(VolleyError error) {
                              // error
                              Log.d("Error.Response", response);
                          }
                      }
              ) {
                  @Override
                  protected Map&lt;String, String&gt; getParams()
                  {
                      Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
                      params.put("username", username);
                      params.put("password", password);
  
                      return params;
                      //return null;
                  }
              };
              queue.add(postRequest);
  
          }
      });
  
  
  }
  </code></pre>
  
  <p>//    @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)</p>
  
  <p>}</p>
  
  <p>How can I implement validation in my login class.</p>