Bluetooth shield from Android connection problem

Hi all!

I have a small program in the arduino that is perfectly working when I do a cat > /dev/rfcomm0 from my linux machine.

Now, I am trying to connect to the arduino throw the Android mobile phone but I can not get it working. With my program (attached) I get this exception:

09-09 23:52:48.710: W/System.err(29740): java.io.IOException: Transport endpoint is not connected
09-09 23:52:48.710: W/System.err(29740): at android.bluetooth.BluetoothSocket.writeNative(Native Method)
09-09 23:52:48.710: W/System.err(29740): at android.bluetooth.BluetoothSocket.write(BluetoothSocket.java:343)
09-09 23:52:48.710: W/System.err(29740): at android.bluetooth.BluetoothOutputStream.write(BluetoothOutputStream.java:56)
09-09 23:52:48.718: W/System.err(29740): at nl.paylogic.bt.BTMain$1.onClick(BTMain.java:73)
09-09 23:52:48.718: W/System.err(29740): at android.view.View.performClick(View.java:3511)
09-09 23:52:48.718: W/System.err(29740): at android.view.View$PerformClick.run(View.java:14105)
09-09 23:52:48.718: W/System.err(29740): at android.os.Handler.handleCallback(Handler.java:605)
09-09 23:52:48.725: W/System.err(29740): at android.os.Handler.dispatchMessage(Handler.java:92)
09-09 23:52:48.725: W/System.err(29740): at android.os.Looper.loop(Looper.java:137)
09-09 23:52:48.725: W/System.err(29740): at android.app.ActivityThread.main(ActivityThread.java:4624)
09-09 23:52:48.725: W/System.err(29740): at java.lang.reflect.Method.invokeNative(Native Method)
09-09 23:52:48.725: W/System.err(29740): at java.lang.reflect.Method.invoke(Method.java:511)
09-09 23:52:48.725: W/System.err(29740): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
09-09 23:52:48.733: W/System.err(29740): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
09-09 23:52:48.733: W/System.err(29740): at dalvik.system.NativeStart.main(Native Method)

I said: ok, this is my problem, let's try a workaround. So I installed Amarino 2.0 [1]. In this program I connect with my device, and on the monitoring I try to send some chars and I can not, the Amarino said that they are sent, but the Arduino doesn't receive anything.

Any help will be more than welcome!

Thanks!

BTMain.java (2.19 KB)