title: Android login using mysql of live server error
body: <p>I am new to Android and I have this code from Android Hive. It runs well but when I use my e-mail and password to login which uses the data of MySQL from live server the app stops to run and shows an error in logcat.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>private void checkLogin(final String email, final String password) {
  
      pDialog.setMessage("Logging in ...");
      showDialog();
      String tag_string_req = "req_login";
  
      StringRequest strReq = new StringRequest(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);
  
                              // Launch main activity
                              Intent intent = new Intent(LoginActivity.this,
                                      MainActivity.class);
                              startActivity(intent);
                              finish();
                          } else {
                              // Error in login. Get the error message
                              String errorMsg = jObj.getString("error_msg");
                              Toast.makeText(getApplicationContext(),
                                      errorMsg, Toast.LENGTH_LONG).show();
                          }
                      } catch (JSONException e) {
                          // JSON error
                          e.printStackTrace();
                      }
  
                  }
              }, new Response.ErrorListener() {
  
                  @Override
                  public void onErrorResponse(VolleyError error) {
                      Log.e(TAG, "Login Error: " + error.getMessage());
                      Toast.makeText(getApplicationContext(),
                              error.getMessage(), 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("tag", "login");
              params.put("email", email);
              params.put("password", password);
  
              return params;
          }
  
      };
  
      // Adding request to request queue
      AppController.getInstance().addToRequestQueue(strReq, tag_string_req);
  }
  </code></pre>
  
  <p>It shows error when it goes inside it.
  Here is the logcat:</p>
  
  <pre><code>07-23 04:02:16.554: W/dalvikvm(1336): threadid=1: thread exiting with uncaught exception (group=0x41465700)
  07-23 04:02:16.584: E/AndroidRuntime(1336): FATAL EXCEPTION: main
  07-23 04:02:16.584: E/AndroidRuntime(1336): java.lang.NullPointerException
  07-23 04:02:16.584: E/AndroidRuntime(1336):     at com.example.ss_suppliers.LoginActivity.checkLogin(LoginActivity.java:165)
  07-23 04:02:16.584: E/AndroidRuntime(1336):     at com.example.ss_suppliers.LoginActivity.access$2(LoginActivity.java:99)
  07-23 04:02:16.584: E/AndroidRuntime(1336):     at com.example.ss_suppliers.LoginActivity$1.onClick(LoginActivity.java:72)
  07-23 04:02:16.584: E/AndroidRuntime(1336):     at android.view.View.performClick(View.java:4240)
  07-23 04:02:16.584: E/AndroidRuntime(1336):     at android.view.View$PerformClick.run(View.java:17721)
  07-23 04:02:16.584: E/AndroidRuntime(1336):     at android.os.Handler.handleCallback(Handler.java:730)
  07-23 04:02:16.584: E/AndroidRuntime(1336):     at android.os.Handler.dispatchMessage(Handler.java:92)
  07-23 04:02:16.584: E/AndroidRuntime(1336):     at android.os.Looper.loop(Looper.java:137)
  07-23 04:02:16.584: E/AndroidRuntime(1336):     at android.app.ActivityThread.main(ActivityThread.java:5103)
  07-23 04:02:16.584: E/AndroidRuntime(1336):     at java.lang.reflect.Method.invokeNative(Native Method)
  07-23 04:02:16.584: E/AndroidRuntime(1336):     at java.lang.reflect.Method.invoke(Method.java:525)
  07-23 04:02:16.584: E/AndroidRuntime(1336):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
  07-23 04:02:16.584: E/AndroidRuntime(1336):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  07-23 04:02:16.584: E/AndroidRuntime(1336):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>Can you please help?</p>