Ejemplo n.º 1
0
    @Override
    protected String doInBackground(String... params) {
      String response = null;

      try {

        ServerCommunicator serverCommunicator = new ServerCommunicator();

        String requestURL = Configuration.GET_CATEGORIES;

        System.out.println("the getting url is++" + requestURL);
        try {
          // 3. build jsonObject
          JSONObject jsonObject = new JSONObject();
          jsonObject.accumulate("category", "All");

          // 4. convert JSONObject to JSON to String
          reqParams = jsonObject.toString();
          Log.d("Login request params:", reqParams);

        } catch (JSONException e) {
          e.getLocalizedMessage();
        }
        response = serverCommunicator.postJSONData(reqParams, requestURL);
      } catch (Exception e) {
        e.printStackTrace();
      }
      System.out.println("responseresponse responseresponse--" + response);
      return response;
    }