Hello, i'm new at this, so i could use some help. How can i use data from "obtainMessage...sendToTarget" in Runnable? I know i would have to use handleMessage but i don't know how to implement it into Runnable.


Java Code:
    public void run() {
	        byte[] buffer = new byte[256];  // buffer store for the stream
	        int bytes; // bytes returned from read()

	        // Keep listening to the InputStream until an exception occurs
	        while (true) {
	        	try {
	                // Read from the InputStream
	                bytes = mmInStream.read(buffer);		// Get number of bytes and message in "buffer"
	                h.obtainMessage(RECIEVE_MESSAGE, bytes, -1, buffer).sendToTarget();		// Send to message queue Handler
	            } catch (IOException e) {
	            	
	                break;
	            }
	        }
	    }
Runnable:

Java Code:
    private final Runnable mLoop = new Runnable() {
	  
	  public void run() {
		  
		for(;;) {
            try {
            	//read data from "obtain message"
                //convert buffer into string
            	Thread.sleep(1000);
            	txt.post(new Runnable() {
					
            		public void run() {
						txt.setText("Data from PIC: " + //post string into textview );
					}
				});
            	
            } catch (InterruptedException e) {

                e.printStackTrace();
            }
            }
	}
	  
      };
Please help...

Regards.