title: update RecyclerView after fetching data from server
body: <p>I´ve got a problem with my RecyclerView. I want to update the Cards (inside the RecyclerView) after fetching the data from the server. First I thought there´s a problem with fetching or parsing the JSON-data, or sending the data via EventBus to the Fragment but when I display the parsed Objects in a TextView in the Fragment, everything is shown up. So the real problem is the RecyclerView / Adapter. 
  I´ve initialized the RecyclerView with an empty ArrayList, but when and HOW do I have to update the data for the RecyclerView? I´ve also read some Posts here on Stackoverflow, but I found no suitable solution...</p>
  
  <p>This is the <strong>onCreateView</strong> from UserFragment</p>
  
  <pre><code>public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
  
      // Inflate the layout for this fragment
      View mView = inflater.inflate(R.layout.fragment_users, container, false);
      mRecyclerView = (RecyclerView) mView.findViewById(R.id.rv_user);
      //set LayoutManager for View
      mLayoutManager = new LinearLayoutManager(getActivity());
      mRecyclerView.setLayoutManager(mLayoutManager);
  
      //set Adapter for View
      mAdapter = new UserAdapter(userList);
      mRecyclerView.setAdapter(mAdapter);
      Log.d(TAG, "onCreateView");
      return mView;
  }
  </code></pre>
  
  <p>and this is my <strong>UserAdapter</strong></p>
  
  <pre><code>public class UserAdapter extends RecyclerView.Adapter&lt;UserAdapter.ViewHolder&gt; {
  
  public static final String TAG = "UserAdapter";
  
  private ArrayList&lt;User&gt; mUser;
  
  public UserAdapter(ArrayList&lt;User&gt; user) {
      mUser = user;
  }
  
  public static class ViewHolder extends RecyclerView.ViewHolder {
      public CardView cv;
      public TextView user_name;
      public TextView user_lastName;
  
      public TextView user_city;
      public ViewHolder(View itemView) {
          super(itemView);
          cv = (CardView) itemView.findViewById(R.id.rv_user);
          user_name = (TextView) itemView.findViewById(R.id.tv_user_name);
          user_lastName = (TextView) itemView.findViewById(R.id.tv_user_lastname);
          user_city = (TextView) itemView.findViewById(R.id.tv_user_city);
          Log.d(TAG, "Viewholder");
      }
  
  }
  
  //initialize Viewholder
  @Override
  public UserAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
      View mView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.row_layout_person, viewGroup, false);
      Log.d(TAG, "onCreateViewHolder");
      return new ViewHolder(mView);
  }
  
  //Bind data to view
  @Override
  public void onBindViewHolder(ViewHolder holder, int position) {
      holder.user_name.setText(mUser.get(position).getUser().getFirstname());
      holder.user_lastName.setText(mUser.get(position).getUser().getLastname());
      holder.user_city.setText(mUser.get(position).getUser().getCity());
      Log.d(TAG, "onBindViewHolder");
  }
  
  public void setUserList(ArrayList&lt;User&gt; user){
      this.mUser = user;
      notifyItemRangeChanged(0, user.size());
      notifyDataSetChanged();
  }
  
  public void updateData(ArrayList&lt;User&gt; userList) {
      mUser.clear();
      mUser.addAll(userList);
      notifyDataSetChanged();
  }
  
  public void removeItem(int position) {
      mUser.remove(position);
      notifyItemRemoved(position);
  }
  
  @Override
  public int getItemCount() {
      Log.d(TAG, "getItemCount");
      if (mUser == null) {
          return 0;
      } else {
          return mUser.size();
      }
  }   }
  </code></pre>
  
  <p>This is the onResponse in the MainActivity: </p>
  
  <pre><code>public void onResponse(Call call, Response response) throws IOException {
              if (response.isSuccessful()) {
                  String responseStr = response.body().string();
                  Gson gson = new Gson();
                  Type userListType = new TypeToken&lt;ArrayList&lt;User&gt;&gt;() {
                  }.getType();
                  final ArrayList&lt;User&gt; userList = gson.fromJson(responseStr, userListType);
                  CustomMessageEvent event = new CustomMessageEvent();
                  event.setUserList(userList);
                  EventBus.getDefault().post(event);
                  System.out.print(responseStr);
                  response.body().close();
              }
          }
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>XML-File (CardView)</p>
  
  <pre><code>&lt;android.support.v7.widget.CardView 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:id="@+id/rv_user"
                                  android:layout_width="match_parent"
                                  android:layout_height="120dp"
                                  android:layout_margin="3dp"
                                  android:elevation="11dp"
                                  android:foregroundGravity="center_horizontal"
                                  android:scrollbars="vertical"
                                  android:theme="@style/AppThemeFSF"
                                  app:cardBackgroundColor="@color/cardview_light_background"
                                  app:cardCornerRadius="4dp"
                                  app:cardElevation="4dp"
  &gt;
  
  &lt;LinearLayout
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:orientation="horizontal"&gt;
  
      &lt;android.support.v7.widget.AppCompatImageView
          android:id="@+id/iv_profile_picture"
          android:layout_width="80dp"
          android:layout_height="80dp"
          android:layout_gravity="center_vertical"
          android:layout_marginBottom="8dp"
          android:layout_marginStart="8dp"
          android:layout_marginTop="8dp"
          android:layout_weight="1"
          android:src="@mipmap/ic_launcher"/&gt;
  
      &lt;LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          android:orientation="vertical"&gt;
  
          &lt;TextView
              android:id="@+id/textView2"
              android:layout_width="wrap_content"
              android:layout_height="30dp"
              android:layout_marginBottom="8dp"
              android:layout_marginEnd="8dp"
              android:layout_marginStart="8dp"
              android:layout_marginTop="8dp"
              android:layout_weight="1"
              android:gravity="left|center"
              android:text="Name"/&gt;
  
          &lt;TextView
              android:id="@+id/textView3"
              android:layout_width="wrap_content"
              android:layout_height="30dp"
              android:layout_marginBottom="8dp"
              android:layout_marginEnd="8dp"
              android:layout_marginStart="8dp"
              android:layout_weight="1"
              android:gravity="left|center"
              android:text="Nachname"/&gt;
  
          &lt;TextView
              android:id="@+id/textView"
              android:layout_width="wrap_content"
              android:layout_height="30dp"
              android:layout_marginBottom="8dp"
              android:layout_marginEnd="8dp"
              android:layout_marginStart="8dp"
              android:layout_weight="1"
              android:gravity="left|center"
              android:text="Stadt"/&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          android:orientation="vertical"&gt;
  
          &lt;TextView
              android:id="@+id/tv_user_name"
              android:layout_width="wrap_content"
              android:layout_height="30dp"
              android:layout_marginBottom="8dp"
              android:layout_marginEnd="8dp"
              android:layout_marginStart="8dp"
              android:layout_marginTop="8dp"
              android:layout_weight="1"
              android:gravity="left|center"
              android:text="Name"
              android:textAppearance="?android:textAppearanceLarge"
              android:textSize="14sp"/&gt;
  
          &lt;TextView
              android:id="@+id/tv_user_lastname"
              android:layout_width="wrap_content"
              android:layout_height="30dp"
              android:layout_marginBottom="8dp"
              android:layout_marginEnd="8dp"
              android:layout_marginStart="8dp"
              android:layout_weight="1"
              android:gravity="left|center"
              android:text="Nachname"
              android:textAppearance="?android:textAppearanceLarge"
              android:textSize="14sp"/&gt;
  
          &lt;TextView
              android:id="@+id/tv_user_city"
              android:layout_width="wrap_content"
              android:layout_height="30dp"
              android:layout_marginBottom="8dp"
              android:layout_marginEnd="8dp"
              android:layout_marginStart="8dp"
              android:layout_weight="1"
              android:gravity="left|center"
              android:text="Stadt"
              android:textAppearance="?android:textAppearanceLarge"
              android:textSize="14sp"
              /&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p><a href="https://i.stack.imgur.com/sAV7B.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sAV7B.png" alt="Snippet from AS"></a></p>
  
  <p><a href="https://i.stack.imgur.com/2ITey.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2ITey.png" alt="Snippet from Logcat"></a></p>
  
  <p>Thanks in advance guys, have a great day! </p>