How to get proper values from Polar heart rate monitor
<p>My android application is getting data from Polar Heart Rate Monitor through Bluetooth connection.
My problem is that I am getting such a string: 
��������������������������������������������������</p>

<p>My code for getting the data:</p>

<pre><code> final Handler handler = new Handler();
    final byte delimiter = 10; //This is the ASCII code for a newline character

    stopWorker = false;
    readBufferPosition = 0;
    readBuffer = new byte[1024];
    workerThread = new Thread(new Runnable()
    {
        public void run()
        {
            while(!Thread.currentThread().isInterrupted() &amp;&amp; !stopWorker)
            {
                try
                {
                    int bytesAvailable = mmInputStream.available();
                    if(bytesAvailable &gt; 0)
                    {
                        byte[] packetBytes = new byte[bytesAvailable];
                        mmInputStream.read(packetBytes);
                        for(int i=0;i&lt;bytesAvailable;i++)
                        {
                            byte b = packetBytes[i];
                            if(b == delimiter)
                            {
                                byte[] encodedBytes = new byte[readBufferPosition];
                               // System.arraycopy(readBuffer, 0, encodedBytes, 0, encodedBytes.length);
                                final String data = new String(encodedBytes, "ASCII");

                                readBufferPosition = 0;

                                handler.post(new Runnable()
                                {
                                    public void run()
                                    {
                                        pulsText.setText(data);
                                    }
                                });
                            }
                            else
                            {
                                readBuffer[readBufferPosition++] = b;
                            }
                        }
                    }
                }
                catch (IOException ex)
                {
                    stopWorker = true;
                }
            }
        }
    });

    workerThread.start();
</code></pre>

<p>I tried to change this line in few ways but I am still getting incorrect data:</p>

<pre><code> final String data = new String(encodedBytes, "ASCII");
</code></pre>

<p>How can I solve this issue ?</p>

<p>Please help !!!</p>
