content: package anna.takeapill;
  
  
  import android.content.Intent;
  import android.support.v7.widget.RecyclerView;
  import android.util.Log;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ImageView;
  import android.widget.TextView;
  
  /**
   * Provide views to RecyclerView with data from mDataSet.
   */
  public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder> {
      private static final String TAG = "CustomAdapter";
  
      private String[] mDataSet;
  
      // BEGIN_INCLUDE(recyclerViewSampleViewHolder)
      /**
       * Provide a reference to the type of views that you are using (custom ViewHolder)
       */
      public static class ViewHolder extends RecyclerView.ViewHolder {
          private final TextView textView;
  
          public ViewHolder(View v) {
              super(v);
              // Define click listener for the ViewHolder's View.
              v.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                      Log.d(TAG, "Element " + getPosition() + " clicked.");
                  }
              });
              textView = (TextView) v.findViewById(R.id.textView);
          }
  
          public TextView getTextView() {
              return textView;
          }
      }
  
      public CustomAdapter(String[] dataSet) {
          mDataSet = dataSet;
      }
  
      @Override
      public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
          // Create a new view.
          View v = LayoutInflater.from(viewGroup.getContext())
                  .inflate(R.layout.text_row_item, viewGroup, false);
  
          ViewHolder vh = new ViewHolder(v);
          return vh;
      }
  
  
      @Override
      public void onBindViewHolder(ViewHolder viewHolder, final int position) {
          Log.d(TAG, "Element " + position + " set.");
  
          // Get element from your dataset at this position and replace the contents of the view
          // with that element
          viewHolder.getTextView().setText(mDataSet[position]);
  
  
      }
  
      @Override
      public int getItemCount() {
          return mDataSet.length;
      }
  }