title: Access layout of one class in another?
body: <p>I have a custom ListView in which there is a textview and an image. I have set onclicklistener for imageview in my customlistadapter class, so I need to make some changes in main layout when the image is clicked. See the below code for reference...</p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>hmDataList.setOnItemClickListener(new OnItemClickListener() {
  
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                  int position, long arg1) {
  
              DataFields dataField = (DataFields) hmDataList
                      .getItemAtPosition(position);
              ImageView v = (ImageView) view.findViewById(R.id.hmFieldDeleteImage);
              RelativeLayout mainRL = (RelativeLayout)view.findViewById(R.id.hmFieldMainRL);
              }
  </code></pre>
  
  <p>}</p>
  
  <p><strong>CustomListAdapter.java</strong></p>
  
  <pre><code>    public View getView(int position, View convertView, ViewGroup parent) {
          holder = null;
          DataFields rowItems = (DataFields) getItem(position);
          LayoutInflater inflater = (LayoutInflater) context
                  .getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
  
          if (convertView == null) {
              convertView = inflater.inflate(R.layout.home_field_row, null);
              holder = new ViewHolder();
              holder.mName = (TextView) convertView.findViewById(R.id.hmFieldName);
              holder.mDeleteImage = (ImageView)convertView.findViewById(R.id.hmFieldDeleteImage);
  
              convertView.setTag(holder);
  
              holder.mDeleteImage.setTag(position);
              final View clickView = convertView;
              holder.mDeleteImage.setOnClickListener(new ImageView.OnClickListener() {
  
                  @Override
                  public void onClick(final View view) {
                      count++;
                      clickView.setBackgroundColor(color.list_row_bg);
                      //
                      //Some changes has to be made for the main activity's layout
                      //
                  }
              });
          }
  
          else {
              holder = (ViewHolder) convertView.getTag();
          }
  
          holder.mName.setText(rowItems.getName());
  
          return convertView;
      }
  </code></pre>
  
  <p><strong>list_row.xml</strong></p>
  
  <pre><code>&lt;TextView
      android:id="@+id/hmFieldName"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentLeft="true"
      android:layout_centerVertical="true"
      android:layout_marginBottom="10dp"
      android:layout_marginLeft="10dp"
      android:layout_marginTop="10dp"
      android:gravity="left"
      android:shadowColor="#000000"
      android:shadowDx="0"
      android:shadowDy="0"
      android:shadowRadius="2"
      android:text="@string/no_data"
      android:textAppearance="?android:attr/textAppearanceMedium"
      android:textColor="#F2F2F2" /&gt;
  
  &lt;ImageView
      android:id="@+id/hmFieldDeleteImage"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentRight="true"
      android:layout_centerVertical="true"
      android:layout_marginBottom="10dp"
      android:layout_marginRight="10dp"
      android:layout_marginTop="10dp"
      android:contentDescription="@string/right_arrow"
      android:src="@drawable/delete" /&gt;
  </code></pre>
  
  <p><strong>activity_main.xml</strong> has some widgets which are hidden, so I need to unhide them when the Image in the custom ListView is clicked.</p>
  
  <p>To put it simple, Is there any way to update the gui of main activity from other class?
  Any kind of help or example or reference is much appreciated. Thanks !</p>