I am writing an application that receives xml from a Web service and displays its contents in a ListView. Since java in general, and Android in particular, for me are new things, I have to recycle mountains of information, often outdated. The design patterns are also very superficially familiar. Now everything works for me, but there is no certainty that I am doing everything right. Please indicate what is wrong with my solution, and what design patterns I used.
My application consists of Application, Activity and Service. I had been reading about how badly to use AsyncTask and therefore decided to use the Services.
Application in onCreate creates a ServiceHelper and provides access to it. An interface is connected to the Activity, the response listener from the service. When you click a button in the Activity, ServiceHelper creates an intent and starts the service. After the service is completed, the service sends the result of the work through the ServiceCallbackListener interface in the bundle.
An event on the onServiceCallback event reads the result from the bundle.
Then I realized that in the case when the Callback from the service comes to a stopped application, the result goes to nowhere.
To solve this problem, I made it so that the service saves to the ServiceHelper bundle with the result of the work, and the Activity, after processing the callback, informs the helper that the cache can be cleared. Now I have an Activity, by the onPostResume event asking ServiceHelper if the service still processes the request with the specified id, if not, if there is no data for this id, and if so, loads them into the ListView and informs the helper that the data with that id need to remove.
Everything is good, but this implementation is inspired by the article https://habrahabr.ru/post/144275/ , which is already five years old. I heard that now in Android they use Loaders, retrofit, rxJava, and many other scary words, from which doubts arose if I don’t take bicycles to use ready-made objects?