title: RecyclerView only show the first array index
body: <p>I want to display all contact that i get from api and show it using recyclerview. But when i want to run the code it show only one contact, actually it has 2 contacts on array.</p>
  
  <p>Recyclerview adapter</p>
  
  <pre><code>    package com.example.ilham.dompettebal;
  
  import android.content.Context;
  import android.support.v7.widget.RecyclerView;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.TextView;
  
  import java.util.List;
  
  public class contactRecyclerAdapter extends RecyclerView.Adapter&lt;contactRecyclerAdapter.ViewHolder&gt; {
  
      private List&lt;String&gt; mData;
      private LayoutInflater mInflater;
      private ItemClickListener mClickListener;
  
  
      contactRecyclerAdapter(Context context,List&lt;String&gt; data)
      {
          this.mInflater = LayoutInflater.from(context);
          this.mData = data;
      }
      @Override
      public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View view = mInflater.inflate(R.layout.contact_recyclerview, parent, false);
          return new ViewHolder(view);
      }
      @Override
      public void onBindViewHolder(ViewHolder holder, int position) {
          String teman = mData.get(position);
          holder.myTextView.setText(teman);
      }
  
      @Override
      public int getItemCount() {
          return mData.size();
      }
  
      public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
          TextView myTextView;
  
          ViewHolder(View itemView) {
              super(itemView);
              myTextView = itemView.findViewById(R.id.usernameTeman);
              itemView.setOnClickListener(this);
          }
  
          @Override
          public void onClick(View view) {
              if (mClickListener != null) mClickListener.onItemClick(view, getAdapterPosition());
          }
      }
  
      String getItem(int id) {
          return mData.get(id);
      }
  
      // allows clicks events to be caught
      void setClickListener(ItemClickListener itemClickListener) {
          this.mClickListener = itemClickListener;
      }
  
      // parent activity will implement this method to respond to click events
      public interface ItemClickListener {
          void onItemClick(View view, int position);
      }
  
  }
  </code></pre>
  
  <p>mainactivity that include get data from server and recyclerview</p>
  
  <pre><code>package com.example.ilham.dompettebal;
  
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.support.v7.widget.LinearLayoutManager;
  import android.support.v7.widget.RecyclerView;
  import android.util.Log;
  import android.view.View;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import com.androidnetworking.AndroidNetworking;
  import com.androidnetworking.common.Priority;
  import com.androidnetworking.error.ANError;
  import com.androidnetworking.interfaces.JSONObjectRequestListener;
  
  import org.json.JSONArray;
  import org.json.JSONException;
  import org.json.JSONObject;
  
  import java.util.ArrayList;
  
  
  public class MainActivity extends AppCompatActivity implements contactRecyclerAdapter.ItemClickListener {
      contactRecyclerAdapter adapter;
      private static final String TAG = "MainActivity";
      private TextView username;
      public String tokenUser;
      public JSONObject namaTeman;
      public JSONArray friends;
      private TextView usernameFriends;
      ArrayList&lt;String&gt; usernameFriendsProfile = new ArrayList&lt;String&gt;();
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          tokenUser= getIntent().getStringExtra("token");
          Log.d(TAG, "tokenmainactivity" + tokenUser); //untuk log pada onerror
          Log.d(TAG, "tokenhalamanselanjutnya " + tokenUser);
          username = (TextView) findViewById (R.id.user);
          usernameFriends = (TextView)findViewById(R.id.usernameTeman);
      initData();
  
  
  
      }
  
      @Override
      public void onItemClick(View view, int position) {
          Toast.makeText(this, "You clicked " + adapter.getItem(position) + " on row number " + position, Toast.LENGTH_SHORT).show();
      }
  
  
      public void initData() {
          //get user
          AndroidNetworking.get("http://10.0.2.2:3000/users")
                  .addHeaders("Authorization","Bearer "+tokenUser)
                  .setPriority(Priority.MEDIUM)
                  .build()
                  .getAsJSONObject(new JSONObjectRequestListener() {
                      @Override
                      public void onResponse(JSONObject response) {
                          Log.d(TAG, "onResponse: " + response); //untuk log pada onresponse
                          try {
  
                              JSONObject obj = new JSONObject(String.valueOf(response));
                              String usernameAkun = obj.getString("username");
                              username.setText(usernameAkun);
                              Log.d(TAG, "namaprofil : " + username);
                              JSONArray friends = obj.getJSONArray("friends");
  
                              for (int i=0;i&lt;friends.length();i++)
                              {
                                  JSONObject objek = friends.getJSONObject(i);
                                  usernameFriendsProfile.add(objek.getString("username"));
                              }
                              Log.d(TAG, "usernametemendidalem : " + usernameFriendsProfile);
  //                            ArrayAdapter&lt;String&gt; arrayAdapter=new ArrayAdapter&lt;String&gt;(MainActivity.this,R.layout.contact_recyclerview,R.id.usernameTeman,usernameFriendsProfile);
  //                            teman.setAdapter(arrayAdapter);
                              RecyclerView recyclerView = findViewById(R.id.teman);
                              recyclerView.setLayoutManager(new LinearLayoutManager(MainActivity.this));
                              adapter = new contactRecyclerAdapter(MainActivity.this, usernameFriendsProfile);
                              adapter.setClickListener(MainActivity.this);
                              recyclerView.setAdapter(adapter);
                          } catch (JSONException e) {
                              e.printStackTrace();
                          }
  
                      }
  
                      @Override
                      public void onError(ANError error) {
                          Log.d(TAG, "onError: Failed" + error); //untuk log pada onerror
                      }
                  });
      }
  
  
  }
  </code></pre>
  
  <p>The values of usernameFriendsProfile is [falah, ilham] but on the display it only shows the first index like this
  The contact interface - </p>
  
  <p><img src="https://i.stack.imgur.com/kfLZM.png" alt="the contact interface"></p>
  
  <p>this is the active_main.xml</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".MainActivity"&gt;
  &lt;RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;ImageView
          android:id="@+id/addFriendButton"
          android:layout_width="25dp"
          android:layout_height="25dp"
          android:layout_marginTop="10dp"
          android:layout_marginRight="20dp"
          android:layout_toLeftOf="@+id/searchButton"
          android:src="@drawable/add_friend"/&gt;
  
      &lt;ImageView
          android:id="@+id/searchButton"
          android:layout_width="25dp"
          android:layout_height="25dp"
          android:layout_marginTop="10dp"
          android:layout_marginRight="20dp"
          android:layout_toLeftOf="@+id/settingButton"
          android:src="@drawable/search"
          /&gt;
  
      &lt;ImageView
          android:id="@+id/settingButton"
          android:layout_width="25dp"
          android:layout_height="25dp"
          android:layout_marginTop="10dp"
          android:layout_marginRight="5dp"
          android:src="@drawable/setting"
          android:layout_alignParentRight="true"
          android:layout_alignParentTop="true"/&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal"
          android:layout_marginLeft="10dp"
          android:layout_marginTop="50dp"
          android:id="@+id/myprofile"
          &gt;
  
          &lt;ImageView
              android:id="@+id/avatar"
              android:layout_width="50dp"
              android:layout_height="50dp"
              android:src="@drawable/avatar" /&gt;
  
          &lt;TextView
              android:id="@+id/user"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:layout_marginLeft="10dp"
              android:text="Username" /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Teman"
          android:layout_below="@id/myprofile"
          android:layout_marginTop="20dp"
          android:paddingLeft="10dp"
          android:id="@+id/contact"
          /&gt;
     &lt;android.support.v7.widget.RecyclerView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_below="@+id/contact"
         android:id="@+id/teman"
         /&gt;
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>this is on contact recycleview xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.constraint.ConstraintLayout
      xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
      &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal"
      android:paddingLeft="20dp"
      &gt;
  
      &lt;ImageView
          android:id="@+id/avatar"
          android:layout_width="50dp"
          android:layout_height="50dp"
          android:src="@drawable/avatar" /&gt;
  
      &lt;TextView
          android:id="@+id/usernameTeman"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          android:layout_marginLeft="10dp"
          android:text="Username" /&gt;
  &lt;/LinearLayout&gt;
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>