title: Is there any way to handle a button from a different activity?
body: <p>Referring to the image below. I want to update the map when the user clicks the View Map button. However, since this is part of an expandable list view, it is in it's own class, while the map itself is in another fragment activity.</p>
  
  <p>Is there any way to listen to the button click and update the map accordingly from another activity? </p>
  
  <p>Thanks!</p>
  
  <p><img src="https://i.stack.imgur.com/MKzmk.png" alt="enter image description here"></p>
  
  <p>Here's what i have so far. I tried getting the parameter via </p>
  
  <pre><code>ExpandableListElement.polyLinePass 
  </code></pre>
  
  <p>but it does not give me anything back so i can't update the map. Also another question, does the map update itself when values are changed like the polyLine, or do I need to setup the map again?</p>
  
  <p>Map Display Activity:</p>
  
  <pre><code>public class OfflineViewer extends FragmentActivity {
      private void setUpMap() {
          List&lt;LatLng&gt; listTemp = util.decodePoly(ExpandableListElement.polyLinePass);
      for(int l=0;l&lt;listTemp.size() - 1;l++){
          list.add(listTemp.get(l));
          if(l==0) {              
          }
      }
          int listSize = list.size();
      //get polyline from expandable list elements
      for (int i = 0; i &lt; list.size() - 1; i++) {
          LatLng src = list.get(i);
          LatLng dest = list.get(i + 1);
          Polyline line = mMap.addPolyline(new PolylineOptions() //mMap is the Map Object
          .add(new LatLng(src.latitude, src.longitude),
          new LatLng(dest.latitude,dest.longitude))
          .width(5).color(Color.BLUE).geodesic(true));
      }
  ...
  }
  </code></pre>
  
  <p>ExpandableListElement  Activity:</p>
  
  <pre><code>public class ExpandableListElement extends RelativeLayout {
          public ExpandableListElement(Context context, String routeName, String mode, String dist, String routeId, String start, String end, final String polyLine) {
      super(context);
      mContext = context;
      setTextViewElements(routeName, mode, dist, routeId, start, end, polyLine);
  
      Button randButton = new Button(mContext);
      randButton.setText("View Map");
      randButton.setId(mIdPool);
      randButton.setOnClickListener(new Button.OnClickListener() {
          public void onClick(View v) {
          polyLinePass = polyLine;
          }
      });
  ...
  }
  </code></pre>