Im very new for android.. I want to get response from restful webservice. Webservice works fine. But, how get response from android.. If i run the application please wait progress only came... Please anyone help
Here my code
public void invokeWS(RequestParams params){ // Show Progress Dialog prgDialog.show(); // Make RESTful webservice call using AsyncHttpClient object AsyncHttpClient client = new AsyncHttpClient(); client.get("http://192.168.2.2:9999/useraccount/login/dologin", params, new JsonHttpResponseHandler() { // When the response returned by REST has Http response code '200' @Override public void onSuccess(int statusCode, Header[] headers, String response) { // Hide Progress Dialog prgDialog.hide(); try { // JSON Object JSONObject obj = new JSONObject(response); // When the JSON response has status boolean value assigned with true if (obj.getBoolean("status")) { Toast.makeText(getActivity().getApplicationContext(), "You are successfully logged in!", Toast.LENGTH_LONG).show(); // Navigate to Home screen //navigatetoHomeActivity(); } // Else display error message else { errorMsg.setText(obj.getString("error_msg")); Toast.makeText(getActivity().getApplicationContext(), obj.getString("error_msg"), Toast.LENGTH_LONG).show(); } } catch (JSONException e) { // TODO Auto-generated catch block Toast.makeText(getActivity().getApplicationContext(), "Error Occured [Server's JSON response might be invalid]!", Toast.LENGTH_LONG).show(); e.printStackTrace(); } } // When the response returned by REST has Http response code other than '200' @Override public void onFailure(int statusCode, Header[] headers, String content, Throwable error) { // Hide Progress Dialog prgDialog.hide(); // When Http response code is '404' if (statusCode == 404) { Toast.makeText(getActivity().getApplicationContext(), "Requested resource not found", Toast.LENGTH_LONG).show(); } // When Http response code is '500' else if (statusCode == 500) { Toast.makeText(getActivity().getApplicationContext(), "Something went wrong at server end", Toast.LENGTH_LONG).show(); } // When Http response code other than 404, 500 else { Toast.makeText(getActivity().getApplicationContext(), "Unexpected Error occcured! [Most common Error: Device might not be connected to Internet or remote server is not up and running]", Toast.LENGTH_LONG).show(); } } }); } In above code, Header[] automatically strike out in onSuccess method. How to fix it. Please anyone help me!!