Transfering files over bluetooth like in Android Bluetooth Chat Example

ぃ、小莉子 提交于 2020-01-01 06:12:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!