Android development, fetch data from API and execute a callback
I love first-class function programming languages (js and python for example), and I use to pass callbacks everywhere, especially when dealing with events or async tasks.
I'm a completely newbie with Java, but I started learning it because I decided time has come to develop android native applications. One of the first functionality I needed and I wanted to master is retrieving information (in json format, in my case) from some sort of API in order to display it in my application.
The equivalent in a modern js application would be making an ajax call to a server endpoint and process the data when fetched. This of course involves the use of callbacks, since data are fetched asynchronously and must ...