Exercise: Android, REST, JSON, simple

In this exercise you must make an Android application to consume this simplee REST service http://rest-service.guides.spring.io/greeting

The service return a String containing JSON.

Getting ready

Make a new Android project.

Do not forget to add

<uses-permission android:name="android.permission.INTERNET" />

to the manifest file.

Call the service and read the response

Call the service http://rest-service.guides.spring.io/greeting

Show the JSON string in a TextField (just to see if you have a connection).

Create a simple model class

Although it is not really needed in this simple example .... do it anyway (you need it in the next, more complex exercise).

Create a simple model class Greeting. Find the properties of the Greeting class from the result of the REST service.

Parse the JSON string using JSONObject

Parse the JSON string using JSONObject (String.split(...), etc not allowed)

Parse the JSON string using GSON

Parse the JSON string using GSON.

Dislay the data

In your application: Display the data contained in the JSON string