title: Mechanism for passing data from one callback to another
body: <p>I want to use Speech to text in my app for actions such as click of a yes or no button.
  I implemented the speech to text in my app.</p>
  
  <p>In that I have a callback method called</p>
  
  <pre><code>   public void onResults(Bundle bundle) {
  
     //here I am getting Yes or No commands via User's Speech
     //bundle object has the data yes/no
  
     }
  </code></pre>
  
  <p>I want to use the result above as an input for some other task which are running in different threads, like for playing or pausing music and turning flash light on or off.</p>
  
  <p>For doing this consider I have these methods below</p>
  
  <pre><code>music.play()
  music.pause()
  flashlight.on()
  flashlight.off()
  </code></pre>
  
  <p>My question is how can I create such a mechanism so that I use Speech to text callback result data and pass it to different task's running in an separate threads and call <code>music.play()</code> or <code>flashlight.on()</code></p>
  
  <p>I tried to use Handlers for this with <code>sendmessage()</code> and <code>handlemessage()</code> methods.
  But I am not able to figure out how can I implement it when main thread is not involved. Because my other task's are there in separate threads.</p>
  
  <p>Can anyone help me with a prototype for this or just the data flow process will be really helpful.</p>