title: Android: Register a SensorEventListener with a Handler?
body: <p>I'm new to Android and I'm trying to write an app that will send sensor data from a phone over the network to a PC.  </p>
  
  <p>I know I shouldn't do 'expensive' operations on the UI thread.  Android allows you to register  a SensorEventListener with a Handler.  </p>
  
  <pre><code>public boolean registerListener (SensorEventListener listener, Sensor sensor, int rate, Handler handler)
  </code></pre>
  
  <p>Here's the link to the same <a href="http://developer.android.com/reference/android/hardware/SensorManager.html#registerListener%28android.hardware.SensorEventListener,%20android.hardware.Sensor,%20int,%20android.os.Handler%29" rel="nofollow">documentation</a>.</p>
  
  <p>Would anybody be able to explain what the purpose of the Handler is?  Should I create a Handler that implements a SensorEventListener? That seems wrong to me, because then I would be passing the same object for two of the arguments (listener &amp; handler).</p>
  
  <p>Thanks!</p>