title: How to change image in first fragment when I pressed back button from the second fragment
body: <p>I want to change an image( i.e @+id/shower) in first fragment (this fragment was added to viewpager) when I backpress from second fragment this fragment is replaced by first fragment second child(Relative layout i.e @+id/view_frame ) </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
   &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:cardview="http://schemas.android.com/apk/res-auto"
  android:orientation="vertical"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  &lt;android.support.v7.widget.CardView
      android:layout_width="match_parent"
      android:id="@+id/frame_indicators"
      android:layout_height="wrap_content"
      cardview:cardUseCompatPadding="true"
  
      &gt;
  &lt;LinearLayout
      android:orientation="vertical"
      android:gravity="center"
       android:paddingTop="@dimen/dp10"
      android:paddingBottom="@dimen/dp10"
      android:layout_gravity="center_horizontal"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"&gt;
      &lt;ImageView
          android:id="@+id/shower"
          android:layout_width="wrap_content"
          android:gravity="center"
          android:scaleType="centerCrop"
          android:layout_gravity="center_horizontal"
          android:src="@drawable/first_plan_indicator"
          android:layout_height="wrap_content"&gt;
  
  
      &lt;/ImageView&gt;
      &lt;LinearLayout
  
          android:layout_marginTop="@dimen/dp5"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:weightSum="3"
          style="@style/Widget.AppCompat.ButtonBar"
          android:gravity="center"
          android:layout_gravity="center_horizontal"
          android:orientation="horizontal"&gt;
          &lt;TextView
  
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:gravity="center"
              android:textColor="@color/navi_selector"
              android:id="@+id/choose_plan_text"
              android:text="Choose Plans"/&gt;
          &lt;TextView
              android:gravity="center"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:id="@+id/enter_details_text"
  
              android:text="Enter Details"/&gt;
          &lt;TextView
              android:gravity="center"
              android:id="@+id/pay_text"
  
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:textColor="@color/textcolor"
              android:text="Payment"/&gt;
  
  
      &lt;/LinearLayout&gt;
    &lt;/LinearLayout&gt;
   &lt;/android.support.v7.widget.CardView&gt;
   &lt;RelativeLayout
      android:id="@+id/view_frame"
  
      android:visibility="visible"
      android:layout_below="@+id/frame_indicators"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"&gt;
  
   &lt;LinearLayout
      android:id="@+id/tabs_type"
      android:gravity="center"
      android:layout_centerHorizontal="true"
      android:layout_width="match_parent"
      android:weightSum="2"
      android:layout_height="wrap_content"
      android:orientation="horizontal"&gt;
      &lt;LinearLayout
          android:layout_weight="1"
          android:layout_width="0dp"
          android:orientation="vertical"
          android:layout_height="wrap_content"&gt;
          &lt;TextView
              android:layout_width="match_parent"
              android:gravity="center"
              android:layout_gravity="center_horizontal"
              android:padding="@dimen/dp10"
              android:id="@+id/for_family"
              android:textColor="@color/black"
              android:textStyle="bold"
              android:layout_height="wrap_content"
              android:text="For Your Family"&gt;        &lt;/TextView&gt;
  
          &lt;View
              android:id="@+id/family_divider"
              android:layout_width="match_parent"
              android:layout_height="3dp"
              android:layout_marginLeft="5dp"
              android:layout_marginStart="5dp"
              android:layout_marginRight="@dimen/dp5"
              android:layout_marginEnd="@dimen/dp5"
              android:background="@color/navi_selector"/&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_weight="1"
          android:layout_width="0dp"
          android:orientation="vertical"
          android:layout_height="wrap_content"&gt;
          &lt;TextView
              android:layout_width="match_parent"
              android:gravity="center"
              android:layout_gravity="center_horizontal"
              android:padding="@dimen/dp10"
              android:textColor="@color/textcolor"
              android:id="@+id/for_you"
              android:layout_height="wrap_content"
              android:textStyle="bold"
              android:text="For You"&gt;        &lt;/TextView&gt;
  
          &lt;View
              android:id="@+id/your_divider"
  
              android:visibility="gone"
              android:layout_marginLeft="5dp"
              android:layout_marginStart="5dp"
              android:layout_marginRight="@dimen/dp5"
              android:layout_marginEnd="@dimen/dp5"
              android:layout_width="match_parent"
              android:layout_height="3dp"
              android:background="@color/navi_selector"/&gt;
      &lt;/LinearLayout&gt;
  
  
  
  &lt;/LinearLayout&gt;
      &lt;android.support.v7.widget.RecyclerView
          android:layout_marginTop="@dimen/dp5"
          android:layout_below="@+id/tabs_type"
          android:id="@+id/packageslist_recyclerview"
          android:layout_width="match_parent"
          android:visibility="visible"
          android:layout_height="wrap_content"&gt;
  
      &lt;/android.support.v7.widget.RecyclerView&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>  </p>
  
  <p>and My code inside FIRST FRAGMET, when I am calling second fragment(registerfragment), I am able to change image by calling indicatorChangesNew() method.</p>
  
  <pre><code>         if (packagesList.getPackageID()==6)
           {
              planListFragmentNew.indicatorChangesNew(1);
          }
          else
      {
          planListFragmentNew.indicatorChangesNew(2);
      } 
      FragmentManager fragmanger=mContext.getFragmentManager();
      FragmentTransaction fragtrans;
      fragtrans = fragmanger.beginTransaction();
      Bundle b=new Bundle();
      b.putDouble("planCost",packagesList.getPackageCost());
      b.putString("planName",packagesList.getPackageName());
      b.putString("paymode",packagesList.getPackageModeOfPay());
      b.putInt("planId",packagesList.getPackageID());
      b.putString("role",packagesList.getRolePatient());
      RegisterFragment registerFragment=new RegisterFragment();
      registerFragment.setArguments(b);
      fragtrans.replace(R.id.view_frame, registerFragment);
      fragtrans.addToBackStack(Constants.FRAG_TAG_REGISTER);
      fragtrans.commit();
  </code></pre>
  
  <p>And my indicatorChangesNew() method is  </p>
  
  <pre><code>    public void indicatorChangesNew(int  checkValue)
     {if (checkValue==1)
      {      mChoosePlanText.setTextColor(getResources()
      .getColor(R.color.textcolor));
            mEnterPlanText.setTextColor(getResources()
          .getColor(R.color.navi_selector));
          mPayText.setTextColor(getResources()
       .getColor(R.color.textcolor));
          mShower.setImageDrawable(getResources()
       .getDrawable(R.drawable.second_plan_indicator));
        }
      else if(checkValue==2)
      {
          mChoosePlanText.setTextColor(getResources().
        getColor(R.color.textcolor));
          mEnterPlanText.setTextColor(getResources()
        .getColor(R.color.textcolor));
          mPayText.setTextColor(getResources()
  
        .getColor(R.color.navi_selector));
          mShower.setImageDrawable(getResources()
     .getDrawable(R.drawable.third_plan_indicator));
      }
      else{
             mChoosePlanText.setTextColor(getResources()
        .getColor(R.color.navi_selector));
      mEnterPlanText.setTextColor(getResources()
     .getColor(R.color.textcolor));
      mPayText.setTextColor(getResources()
       .getColor(R.color.textcolor));
      mShower.setImageDrawable(getResources()
   .getDrawable(R.drawable.first_plan_indicator));}
  }
  </code></pre>