问题
How to use Android Bluetooth Chat Example and chaneg it for file transfer. I want to transfer local SQLite database to another Android device via bluetooth.
I changed the example code (http://developer.android.com/resources/samples/BluetoothChat/index.html), but if I send file bigger than 1024 bytes long, then I get more events triggered in Handler class. I tried to send small txt file and it's working (smaller than 1k).
Can somebody help me please.
Thanks, Toni
回答1:
Read buffer in that example is set to 1024 bytes. After each read, which is max 1024 bytes long, it sends a message to the handler.
http://developer.android.com/resources/samples/BluetoothChat/src/com/example/android/BluetoothChat/BluetoothChatService.html
(search for 1024)
来源:https://stackoverflow.com/questions/7380402/transfering-files-over-bluetooth-like-in-android-bluetooth-chat-example