Retrofit Callback instead of Async Handler

   For a quick and dirty solution I used an async handler in my activity, to call an api. I sometime need to see things work right for a sanity check, and win whatever small achievement it holds. Whether its just to reassure me I'm on the right path. So below is a quick and simple change but makes all the difference.

@GET("/GetTimes/{id}")
public ArrayList<YourObject> GrabData(@Path("id") String id);
vs
@GET("/GetTimes/{id}")
void GrabData(@Path("id") String id, Callback<ArrayList<YourObject>> callback);

Resources
using Square's Retrofit networking library
Retrofit.Callback's success() and failure()
If you callback is in a fragment
Receiving custom parameter in retrofit callback

Popular posts from this blog

Aspetcore: NLog with Postgresql

Mongodb Cheatsheet

Installing Windows on Acer chromebook 15 cb3-532