在Android的蓝牙聊天实例Transfering通过蓝牙文件,如蓝牙、实例、文件、Android

2023-09-05 08:19:22 作者:成瘾。

如何使用Android的蓝牙聊天实例和chaneg它进行文件传输。我想通过蓝牙本地SQLite数据库转移到另一个Android设备。

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.

我改变了例如code(http://developer.android.com/resources/samples/BluetoothChat/index.html),但如果我发送文件大于1024字节长,然后我得到触发了事件在Handler类。 我试图发送小的TXT文件和它的工作(小于1K)。

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).

有人可以帮我请。

谢谢, 托尼

推荐答案

读缓冲区在例如设置为1024字节。每个读取,这是最大1024字节长之后,它发送一个消息到该处理程序。

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

(搜索1024)