My bluetooth app stps working unexpetedly....It's a fairly small program
<p>I'm having a problem with my bluetooth app unexpectedly closing....</p>

<p>The code can succesfully do the following....</p>

<p>(1) Get the bluetooth adapter
(2) Enable the bluetooth adapter</p>

<p>The problem seems to occur when trying to query paired devices....</p>

<p>The problem seems to be at the end of the code where this code block occurs....</p>

<pre><code>Set&lt;BluetoothDevice&gt; pairedDevices = mBluetoothAdapter.getBondedDevices();  
// If there are paired devices
if (pairedDevices.size() &gt; 0) {        
// Loop through paired devices    
    for (BluetoothDevice device : pairedDevices) {       
        // Add the name and address to an array adapter to show in a ListView
        mArrayAdapter.add(device.getName() + "\n" + device.getAddress());    
    }
}
</code></pre>

<p>Here is the complete code:</p>

<pre><code>Set&lt;BluetoothDevice&gt; pairedDevices = mBluetoothAdapter.getBondedDevices();  
// If there are paired devices
if (pairedDevices.size() &gt; 0) {        
// Loop through paired devices    
    for (BluetoothDevice device : pairedDevices) {       
        // Add the name and address to an array adapter to show in a ListView
        mArrayAdapter.add(device.getName() + "\n" + device.getAddress());    
    }
}
</code></pre>
