Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends.
I Wrote A Program that Connect to server with volley in android .
it work write but show me on screen Null .
I Use Log In Volley And See Correct Answer But In Run Program I See Null In Output.
Please Help me To find this.

What I have tried:

public String logInAdminToServer(JSONObject jsonObject) {
      JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST,
              "http://192.168.43.206/project-server/Admin.php?action=LogInAdmin", jsonObject,
              new Response.Listener<JSONObject>() {
                  @Override
                  public void onResponse(JSONObject response) {
                      try {
                          firstName = response.getString("AdminFirstName");
                          lastName = response.getString("AdminLastName");
                          Log.i("Error", firstName + lastName);
                      } catch (JSONException e) {
                          e.printStackTrace();
                      }
                  }
              },
              new Response.ErrorListener() {
                  @Override
                  public void onErrorResponse(VolleyError error) {
                      Log.i("Error", error.toString());
                  }
              });
      Volley.newRequestQueue(G.context).add(request);
      return firstName + "," + lastName;
  }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900