jeudi 9 février 2017

Pattern to delegate network access to the caller/user of a component

I want to create a custom view that I need it to be reusable.
This view needs to access a specific network service to fetch a very minimal amount of data in order to be able to show what it is supposed.
I don't want to use any AsyncTask inside the view as I prefer for the user of the view to handle all the network responsibility.
What is the best approach I can use for such a delegation approach?
Basically the view somehow passes the server address to the caller (listener?) and only the view knows how to parse the response and get the data from the response

Aucun commentaire:

Enregistrer un commentaire