Now that we have seen how to do some background processing and decode the data by ourselves, we will see how to implement the networking code. We will start by showing the standard classes and libraries Android provides us, and later we will cover widely used third-party networking libraries.
As we have just mentioned earlier, there are a lot of third party libraries that will make our lives easier, but it is important to know the basics. Android provides a set of standard classes and libraries which are not really used anymore by application developers unless there is something very specific of low-level access is required. Anyway, we will briefly show a possible implementation of an HTTP downloader and then will switch to higher level-party libraries.
In the previous example, we did not show the implementation of the loadDataFromURL
method, as we will cover it here in this section:
What we are doing in this implementation is to create an HttpURLConnection...