title: Pass value from Activity to custom View
body: <p>I need to pass a value from my main Activity to a custom View. </p>
  
  <p>In the main activity I have a SensorEventListener so I'm continuosly listening to the light sensor. In the onSensorChanged() method I read the value, and I need to send this value every time it changes to my custom View.</p>
  
  <p>I don't know which is the best way to achive this. </p>
  
  <p><strong>UPDATE --</strong></p>
  
  <p>Method refered to SensorEventListener on main activity:</p>
  
  <pre><code>@Override
  public void onSensorChanged(SensorEvent event) {
      float lumnes = event.values[0];
      GaugeView.setHandTarget(lumnes);
  }
  </code></pre>
  
  <p>Method I have to send values to in custom view:</p>
  
  <pre><code>public void setHandTarget(float temperature) {
      if (temperature &lt; minDegrees) {
          temperature = minDegrees;
      } else if (temperature &gt; maxDegrees) {
          temperature = maxDegrees;
      }
      handTarget = temperature;
      handInitialized = true;
      invalidate();
  }
  </code></pre>
  
  <p>I cannot use static references cause then I cannot call invalidate()</p>