title: android login volley error
body: <p>I am doing android login tutorial using volley from android hive. but when i tried it, it will go to volley error, i don't know why, i am just a beginner in android. Please help me. . I run my project in an emulator and connect it using usb debugging. My emulator is NOX.</p>
  
  <p>I already finished the setup from the database.</p>
  
  <p>After logging in, i want to intent my Dashboard class, but it doesn't intent , it goes with these erroe below</p>
  
  <p>Here is the code where the error comes:</p>
  
  <pre><code>public void onErrorResponse(VolleyError error) {
                  //Log.e(TAG, "Login Error: " + error.getMessage());
                  Toast.makeText(Login.this,
                          "VOLLEY ERROR", Toast.LENGTH_LONG).show();
                  hideDialog();
              }
  </code></pre>
  
  <p>and the full code of that is this class:</p>
  
  <pre><code>package com.example.codeboxjohn.clinic.activity;
  
  import android.app.ProgressDialog;
  import android.content.Intent;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.Toast;
  
  
  import com.android.volley.Request;
  import com.android.volley.Response;
  import com.android.volley.VolleyError;
  import com.android.volley.toolbox.StringRequest;
  import com.example.codeboxjohn.clinic.R;
  import com.example.codeboxjohn.clinic.app.AppConfig;
  import com.example.codeboxjohn.clinic.app.AppController;
  import com.example.codeboxjohn.clinic.helper.SessionManager;
  
  import org.json.JSONException;
  import org.json.JSONObject;
  
  import java.util.HashMap;
  import java.util.Map;
  
  
  public class Login extends AppCompatActivity {
  
      private Button btnLogin;
      private EditText inputUsername;
      private EditText inputPassword;
      private ProgressDialog pDialog;
      private SessionManager session;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_login);
          btnLogin = (Button)findViewById(R.id.btnLogin);
          inputUsername = (EditText) findViewById(R.id.editTextUsername);
          inputPassword = (EditText) findViewById(R.id.editTextPassword);
  
          pDialog = new ProgressDialog(this);
          pDialog.setCancelable(false);
  
          //login
          btnLogin.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  String username = inputUsername.getText().toString().trim();
                  String password = inputPassword.getText().toString().trim();
  
                  if(!username.isEmpty() &amp;&amp; !password.isEmpty()) {
                      checkLogin(username, password);
                  } else {
                      Toast.makeText(getApplicationContext(),"Please enter the credentials!", Toast.LENGTH_SHORT).show();
                  }
              }
          });
      }
  
      private void checkLogin(final String username, final String password) {
          //Tag used to cancel the request
          String tag_string_req = "req_login";
  
          pDialog.setMessage("Logging in..");
          showDialog();
  
          StringRequest strReq = new StringRequest(Request.Method.POST,
                  AppConfig.URL_LOGIN, new Response.Listener&lt;String&gt;() {
  
              @Override
              public void onResponse(String response) {
                  //Log.d(TAG, "Login Response: " + response.toString());
                  hideDialog();
  
                  try {
                      JSONObject jObj = new JSONObject(response);
                      boolean error = jObj.getBoolean("error");
  
                      // Check for error node in json
                      if (!error) {
                          // user successfully logged in
                          // Create login session
                          session.setLogin(true);
  
                          // Inserting row in users table
  
                          // Launch main activity
                          Intent intent = new Intent(Login.this,
                                  Dashboard.class);
                          startActivity(intent);
                          finish();
                      } else {
                          // Error in login. Get the error message
                          String errorMsg = jObj.getString("error_msg");
                          Toast.makeText(getApplicationContext(),
                                  "ERROR KO", Toast.LENGTH_LONG).show();
                      }
                  } catch (JSONException e) {
                      // JSON error
                      e.printStackTrace();
                      Toast.makeText(getApplicationContext(), "Json error: " + response.toString(), Toast.LENGTH_LONG).show();
                  }
  
              }
          }, new Response.ErrorListener() {
  
              @Override
              public void onErrorResponse(VolleyError error) {
                  //Log.e(TAG, "Login Error: " + error.getMessage());
                  Toast.makeText(Login.this,
                          "VOLLEY ERROR", Toast.LENGTH_LONG).show();
                  hideDialog();
              }
          }) {
  
              @Override
              protected Map&lt;String, String&gt; getParams() {
                  // Posting parameters to login url
                  Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
                  params.put("username", username);
                  params.put("password", password);
  
                  return params;
              }
  
          };
  
          // Adding request to request queue
          AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
      }
  
      private void showDialog() {
          if(!pDialog.isShowing())
                  pDialog.show();
      }
  
      private void hideDialog() {
          if(pDialog.isShowing())
              pDialog.dismiss();
      }
  
  }
  </code></pre>