First things first. Take a look at AsyncTask in Android. AsyncTask
is used to perform operations asynchronously. Take a look at this answer explaining how parameters are passed to AsyncTask
.
You can use libraries mentioned bellow to do same thing:
- Asynchronous Http Client
- Volley
Once you communicate with server and receive response, you have to parse JSON
data.
The key you have to remember for this is
[] - square bracket represents JSON Array
{} - curly bracket represents JSON Object
Everything else will be combination of these.
This tutorial will help you regarding JSON parsing
.
JSON object to Java object conversion
To convert json
data to java
object you can use:
- Jackson
- Gson
Follow this link or this link for nice GSON
tutorial.
I personally used GSON
, and it is best library for json
to java object
conversion.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…