JSON “arrays” parsing using Retrofit and RecycleView

0. URL for parsing is http://shaoniiuc.com/json_bangla, which looks like this:

  1. In build.gradle add dependencies:

2. In AndroidManifest.xml add internet permission:

3. In activity_main.xml create RecyclerView component

4. Create recycler_view_row.xml with components which are required:

5. Create User.java model class. Names of the fields should be the same as in JSON array names. And create Setters and Getters, and contructor with parameters.

6. Create interface with the name APIService.java

“@GET” — annotation is the last part of our request URL, which can dynamically change.

7. Create adapter RecyclerViewAdapter.java:

8. Add code to MainActivity.java: