Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 126.96.36.199 release ready!
Owner and Founder. Opencart
Retrofit 2 is one the best library I have used it so far. There are many cases in which we can use custom callback for our response callback such as Error Handling, Response Handling, Custom Response and much more.
By using a custom callback or any piece of custom code in an application we are promoting object oriented design pattern and thus reducing your efforts that are needed/mandatory to follow if not using it.
Here is an example of Custom Callback that is used to handle error , hide dialog and return response data to original callback.
By using Custom Callback, we are preventing from extra effort required to handle error in each request. Plus, we can perform custom operation that are required whenver the response is recieved. In this case we are just hidding the AlertDialog.
We can use this callback instead of our existing callback. e.g.
And Here is the original callback which gets called from our Custom RetrofitCallback
That’s all it take for laziness!
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.