Android Bluetooth enable
<p>I am developing a Bluetooth chat application. The problem is that when i enable Bluetooth the application enables Bluetooth but causes force close. the next time i launch the same application(with Bluetooth enabled) it works smoothly ! i have searched and only got some information saying that when i start the intent for enable Bluetooth the code proceeds not waiting for the result of Intent</p>

<pre><code>        public void run() {

        // 1. Check if Bluetooth is Enabled
        if (!blue.isEnabled()) {
            Intent enable_Bluetooth = new Intent(
                    BluetoothAdapter.ACTION_REQUEST_ENABLE);
            startActivityForResult(enable_Bluetooth, 1);

        }

        // 2. Start Bluetooth Server
        try {
            Server = blue.listenUsingRfcommWithServiceRecord("dhiraj",
                    MY_UUID);
</code></pre>
