parsing json and display with recycler view and card view

3.4k Views Asked by At

I need to parse json then view it in cards in recycler view. I need help in doing this with easy steps as I am still a junior. one important note I have to say is that I need to make this view in a fragment not an activity.

Thank you in advance. This is the json code I want to parse.

{"teamMembersList":[{"id":1,"name":"Mona Shahien","position":"DIRECTOR","description":"DIRECTOR","image":"209.126.105.42:8001/Images/TeamMembers/1.jpg"},{"id":2,"name":"Beshoy Fayez","position":"SENIOR PROGRAM MANAGER","description":"SENIOR PROGRAM MANAGER : Very Good ","image":"209.126.105.42:8001/Images/TeamMembers/2.jpg"},{"id":3,"name":"Sarah ElRawy","position":"SENIOR PROGRAM MANAGER","description":"SENIOR PROGRAM MANAGER : don\u0027t know","image":"209.126.105.42:8001/Images/TeamMembers/3.jpg"}]}

I have created layout for card view and another layout have recycler view This is the code of card view layout:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent">
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <android.support.v4.widget.CircleImageView
        android:id="@+id/image_of_our_teams"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        />
    <android.support.v7.widget.AppCompatTextView
        android:id="@+id/name_of_team_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    <android.support.v7.widget.AppCompatTextView
        android:id="@+id/position_of_team_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
</RelativeLayout>
</android.support.v7.widget.CardView>

and this is the layout that contain recycler view :

<?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
    android:id="@+id/my_recycler_view"
    android:scrollbars="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
</RelativeLayout>

Now what do I need to do?

1

There are 1 best solutions below

0
On