1

I am writing a simple Android app and have a database that will send back information into the app. I am new to Android and am looking for a simple example that demonstrates how the Android App can process a JSON response received from a HTTP request.

I need to see what classes are used for Android apps to process a HTTP response. A reference to a good tutorial, or if you're keen, write a very basic method to do the job. Thanks

3 Answers 3

3

Take a look to: JSON Parsing in android or Android as a RESTful Client.

Also read Handling Expensive Operations in the UI Thread to be sure that your application is not "hanging" if content retrieval takes time.

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

1 Comment

Those 2 links were really helpful. Seems to cover the topic enough for me. So you get the "correcta-mundo". Thanks!!!
2

I once wrote a tutorial for the exact opposite case (to send a JSON request). However from that you will be able to derive for what you need.

1 Comment

Thanks for submitting your tutorial. I'll have a look at it and try it out. I need to support XML and JSON.
0

I wrote a small library project (stepsdk) and demo here, on making a GET request and process the json here.

It is as simple as follows:

new APIRequest(new APIManager(this), SERVER_URL+"/method", APIRequest.GET)
  .addParam('param', 'value')
  .start(new JSONRequestHandler(){
      @Override
      public void after() {
        JSONObject json = getResponse();
        // use json
      }
  });

hope it helps.

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.