0

Reading this question : POSTing JSON/XML using android-async-http (loopj) in order to post json where is the context value set ?

The accepted answer uses a context value as a parameter within post method invocation :

JSONObject jsonParams = new JSONObject();
jsonParams.put("notes", "Test api support");
StringEntity entity = new StringEntity(jsonParams.toString());
client.post(context, restApiUrl, entity, "application/json",
    responseHandler);

Where is the context set ? Previously I used RequestParams for sending data where context is not required but a context value is required when sending json data ?

2
  • I believe this should be a comment to the original answer and not another SO question. Commented Nov 22, 2016 at 19:52
  • I disagree Micer Commented Aug 9, 2018 at 20:59

1 Answer 1

0

Maybe this question should be deleted but can request the context from the main activity using : Context context = this.getApplicationContext();

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.