title: RecyclerView.Adapter displays layout only once
body: <p>I'm trying to display list of items using RecyclerView. The problem is that layout is displayed only for first element from <code>List&lt;BaseSensor&gt; measurements</code>.</p>
  
  <p>My adapter:</p>
  
  <pre><code>public class MeasurementsAdapter extends RecyclerView.Adapter&lt;RecyclerView.ViewHolder&gt; {
  
      private List&lt;BaseSensor&gt; measurements;
      private Context context;
  
      public MeasurementsAdapter(Context context, List&lt;BaseSensor&gt; measurements) {
          this.context = context;
          this.measurements = measurements;
      }
  
      @Override
      public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          if (viewType == BaseSensor.DEVICE_TYPE_OXIMETER) {
              View rootView = LayoutInflater.from(parent.getContext()).inflate(R.layout.oximeter_list_item, parent, false);
              return new OximeterView(rootView);
          }
  
          throw new RuntimeException("there is no type that matches the type " + viewType + " + make sure your using types correctly");
      }
  
      @Override
      public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
          final BaseSensor item = measurements.get(position);
  
          if (viewHolder instanceof OximeterView) {
              OximeterView holder = (OximeterView) viewHolder;
              holder.tvPulse.setText(String.valueOf(((OximeterSensor)item).getPulse()));
          }
      }
  
      @Override
      public int getItemCount() {
          return measurements.size();
      }
  
      @Override
      public int getItemViewType(int position) {         
          return BaseSensor.DEVICE_TYPE_OXIMETER;
      }
  
      public static class OximeterView extends RecyclerView.ViewHolder {
  
          private TextView tvPulse;
  
          public OximeterView(View rootView) {
              super(rootView);
              tvPulse = (TextView) rootView.findViewById(R.id.tvPulse);
          }
      }
  } 
  </code></pre>
  
  <p><code>onBindViewHolder</code> method is called twelve times, once for each element of measurements list however <code>tvPulse</code> is displayed only once with value of the the first element of my list.</p>
  
  <p>EDIT:</p>
  
  <pre><code>public class MeasurementsFragment extends BaseFragment {
  
      private RecyclerView rvMeasurements;
      private List&lt;BaseSensor&gt; measurements;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          View rootView = inflater.inflate(R.layout.fragment_measurements, container, false);
  
          rvMeasurements = (RecyclerView) rootView.findViewById(R.id.rvMeasurements);
          rvMeasurements.setLayoutManager(new LinearLayoutManager(getActivity()));
  
          MeasurementsAT measurementsAT = new MeasurementsAT();
          measurementsAT.execute();
  
          return rootView;
      }
  
      private class MeasurementsAT extends AsyncTask&lt;Void, Void, Void&gt; {
  
          @Override
          protected Void doInBackground(Void... params) {
  
              DatabaseManager.createInstance(getActivity());
              measurements = DatabaseManager.getInstance().getAllMeasurements();
  
              return null;
          }
  
          @Override
          protected void onPostExecute(Void bitmap) {
              MeasurementsAdapter adapter = new MeasurementsAdapter(getActivity(), measurements);
              rvMeasurements.setAdapter(adapter);
          }
      }
  }
  </code></pre>