• Latest Code...

    How to use Retrofit to get data from stackoverflow API and GitHub Demo in android studio

    Retrofit is a type-safe REST client for Android developed by Square. The library provides a powerful framework for authenticating and interacting with APIs and sending network requests with OkHttp. See this guide to understand how OkHttp works.

    This library makes downloading JSON or XML data from a web API fairly straightforward. Once the data is downloaded then it is parsed into a Plain Old Java Object (POJO) which must be defined for each "resource" in the response.

    Must be defined on internet permission on AndroidManifest.xml .

    Add following dependencies on app/build.gradle file:

    Here is the different type of  Gson converter, we can use them:

    How to create retrofit instance, 
    then we have to define, the userendpoint:
    Now, create model class, user variables, In MainActivity.java, we have to create instance of APIClient and call the users.

    Download Full code: https://github.com/dharmakshetri/Android-API-Demos
    and you can find out Awesome Retrofit Article: Retrofit Tutorial With Example In Android Studio [Step by Step]
    More details:

    Happy Coding !!!

    1 comment:


    Most recent Elastic Search tutorials for beginner, intermediate and advance level developer, Yubraj Pokharel, in CodingWorkspace