title: How do i call a method of an Activity from its Recycler View Adapter? Or better,How to access the UI elements of an activity from the adapter?
body: <p>I have a Recycler View in ItemActivity and its Adapter as a seperate class ItemAdapter.Now based on the count of the Item chosen i need to update the text on a button placed in ItemActivity.How can it be done?</p>
  
  <p>note:I have passed getApplicationContext() as the context to the Adapter.It passes the GlobalValue context which I have set in the manifest.</p>
  
  <pre><code>&lt;application
      android:name=".GlobalValues"
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:theme="@style/AppTheme"&gt;
  </code></pre>
  
  <h2>The following is my ItemActivity.xaml</h2>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
      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"
      android:layout_margin="5dp"
      tools:context=".ItemPickerActivity"&gt;
  
      &lt;TextView
          android:id="@+id/itemstext"
          android:layout_marginTop="5dp"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Choose Items"
          android:fontFamily="@font/exo_semibold"
          android:textColor="@color/dark_grey"              
          /&gt;    
      &lt;android.support.v7.widget.RecyclerView
          android:layout_marginHorizontal="3dp"
          android:id="@+id/pickerRecview"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_below="@id/itemstext"
          android:layout_marginTop="7dp" /&gt;
  
      &lt;RelativeLayout
          android:layout_alignParentBottom="true"
          android:layout_width="match_parent"
          android:layout_height="50dp"
          android:padding="10dp"
          android:id="@+id/checkout"
          android:clickable="true"
          android:background="@color/go_green"
          &gt;
  
          &lt;TextView
              android:id="@+id/Total"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Rs XXX"
              android:layout_marginLeft="5dp"
              android:textSize="18sp"
              android:textColor="@color/white"
              android:layout_centerVertical="true"
              android:fontFamily="@font/exo_semibold"
              /&gt;
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Checkout"
              android:textColor="@color/white"
              android:layout_centerVertical="true"
              android:layout_centerHorizontal="true"
              android:textSize="22sp"
              android:fontFamily="@font/exo_semibold"
              /&gt;
  
          &lt;TextView
              android:id="@+id/TotalItems"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentRight="true"
              android:layout_centerVertical="true"
              android:layout_marginRight="5dp"
              android:text="xx Items"
              android:fontFamily="@font/exo_semibold"
              android:textColor="@color/white"
              android:textSize="18sp" /&gt;   
      &lt;/RelativeLayout&gt;        
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>And this is how i instantiate the adapter object</strong></p>
  
  <pre><code>ItemPickerAdapter adapter = new ItemPickerAdapter(getApplicationContext(), ItemsList);
  
              recyclerView.setAdapter(adapter);
  </code></pre>
  
  <p>I need to change the value of ItemCount in my ItemActitvity from the adapter!Please advise me on how it is possible.Thanks!</p>