• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Json Parsing

Medy

Lurker
Hi guys , im learning about Android development atm.
Im at a beginner lvl and to be precise im looking into networking atm , because I want to build apps that use APIs efficiently.


Now so far I got introduced to Asynchtask / Loaders / Viewholder to handle network request in JSON format.
Since I have been looking into this topic , I also heard ppl mention liberies like retrofit.


AsynchTask seems to handle the basic functionality and is the first thing the official doc would point you to.

But I wanted to ask more experienced devs for advice when it comes to networking + JSON request handling + loading images into a android app as smoothly as possible.

Would you go with Asynchtask or did you find smth else / easier ?
To me as a beginner it feels like there is a overwhelming amount of concepts like threading etc that I all need to adress in my code. I mean I understand most of it now , but really it seems to be a big hassle to keep track of it all & I want my code to be as easy/ short as possible.


Greetings.
 
Welcome to Android Forums. I moved your thread to Application Development forum because this is the place to ask app development related questions.

If you want to retrieve and parse JSON from a remote server, then use Retrofit, and you don't need to worry about AsyncTask. The library handles all the threading stuff which calls the server, and all you need to worry about is mapping the response into your Java model. So if you want to go down the convenient route, then use Retrofit.

But if you want to understand the underlying concepts and learn about Android's threading model and the nuts and bolts of
making a HTTP call to a remote server, then use the basic building blocks, like AsyncTask. I personally think it's useful to understand what's going on behind the scenes.

Actually, AsyncTask is itself a convenience class, which enables a background thread to update components on the UI thread. When it comes down to it, you're using a background thread to do all the network processing. That is the basic concept.
 
Welcome to Android Forums. I moved your thread to Application Development forum because this is the place to ask app development related questions.

If you want to retrieve and parse JSON from a remote server, then use Retrofit, and you don't need to worry about AsyncTask. The library handles all the threading stuff which calls the server, and all you need to worry about is mapping the response into your Java model. So if you want to go down the convenient route, then use Retrofit.

But if you want to understand the underlying concepts and learn about Android's threading model and the nuts and bolts of
making a HTTP call to a remote server, then use the basic building blocks, like AsyncTask. I personally think it's useful to understand what's going on behind the scenes.

Actually, AsyncTask is itself a convenience class, which enables a background thread to update components on the UI thread. When it comes down to it, you're using a background thread to do all the network processing. That is the basic concept.

The course I took used Asynchtask & it was intersting to see what problems pop up & how they are handled. But the code was tediously long & kept getting longer. The course didnt mention libaries ,so Im glad I stumbled upon retrofit. I found there is another libary called volley from google . Guess these will be my goto libaries when I want to handle threading and caching images etc... Also now that Iknow what volley is , I fiund out that the api wrapper im using has volley built in. Problem solved I guess . Maybe that course was older than 2013 where those libaries where introduced. xD
 
Back
Top Bottom