title: How to get a reference to a ViewHolder, from inside another ViewHolder? (RecyclerView)
body: <p>I have a <code>RecyclerView</code> with some <code>view</code>'s/<code>card</code>'s (let's call it a view for now), which all contain the same things, including a <code>View</code> that I'm using as a divider bar.</p>
  <p>I want to be able to change the properties of this divider bar in the <code>view</code> above the current one. So say I click on the card that says <code>test3</code>, I want to be able to set the properties of the divider bar that's in the <code>test2</code> <code>view</code>.</p>
  <h3>To clarify:</h3>
  <p>I only need a reference to the <code>ViewHolder</code> for the view <strong>above</strong> (or any other for that matter) the one I click, that's all. How should I do this?</p>
  <p><a href="https://i.stack.imgur.com/dhu47.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/dhu47.jpg" alt="enter image description here" /></a></p>
  <pre><code>public class StuffManagerAdapter extends RecyclerView.Adapter&lt;StuffManagerAdapter.MyViewHolder&gt; {
  
      private List&lt;StuffManagerClass&gt; stuffList;
      private Context context;
      private String TAG = &quot;CStA&quot;;
      DBHandler dbHandler;
      ArrayList&lt;String&gt; tagArray = new ArrayList&lt;&gt;();
      RecyclerView mRecyclerView;
  
      public StuffManagerAdapter(List&lt;StuffManagerClass&gt; stuffList, Context context) {
          this.stuffList = stuffList;
          this.context = context;
          dbHandler = DBHandler.getInstance(context);
      }
  
      public class MyViewHolder extends RecyclerView.ViewHolder {
          public TextView DeviceTV, NameTV, TagTV;
          private ImageButton editButton, deleteButton;
          public ImageView tagWarningImage;
          View view, bottomBar ,cover;
  
          public MyViewHolder(final View view) {
              super(view);
              this.view = view;
              DeviceTV = (TextView) view.findViewById(R.id.SMVFDeviceTextView);
              // etc., etc.
  
              editButton.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                      // do stuff
                  }
              });
              deleteButton.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                      // do stuff
                  }
              });
          }
      }
  
      @Override
      public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.fragment_stuffmanagervariablefragment, parent, false);
          return new MyViewHolder(itemView);
      }
  
      @Override
      public void onBindViewHolder(final MyViewHolder holder, final int position) {
          final StuffManagerClass sc = stuffList.get(position);
  
          // Initialize card, set all textviews
          holder.DeviceTV.setText(sc.getDevice());
          holder.NameTV.setText(sc.getName());
          holder.TagTV.setText(sc.getTag());
          sc.setPosition(position);
  
          
          holder.view.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {    
                  // This is where I would like to get a reference to the divider bar on the other view/card
              }
          });
      }
  
      @Override
      public int getItemCount() {
          return stuffList.size();
      }
  }
  </code></pre>
  <hr />
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;FrameLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;&gt;
  
      &lt;RelativeLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;&gt;
  
          &lt;!-- TextViews and stuff --&gt;
  
          &lt;View
              android:id=&quot;@+id/SMVFDividerBar&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;2dp&quot;
              android:layout_below=&quot;@+id/LL2&quot;
              android:layout_centerHorizontal=&quot;true&quot;
              android:layout_marginLeft=&quot;7dp&quot;
              android:layout_marginRight=&quot;7dp&quot;
              android:background=&quot;@color/colorPrimaryDark&quot;&gt;
  
      &lt;/RelativeLayout&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>