简体   繁体   English

在Android中通过蓝牙传输图像

[英]Transfer an Image via Bluetooth in Android

I am developing an Android application which needs an image to be transmitted from one android device to another via bluetooth.The image size goes upto 3 to 4 MB.The problem I am facing is that when i send the image in form of bytes, the image is received in parts not in single stretch. 我正在开发一个Android应用程序,它需要一个图像通过蓝牙从一个Android设备传输到另一个。图像大小上升到3到4 MB。我面临的问题是当我以字节的形式发送图像时,图像是在非拉伸的部分接收的。 For eg i transferred an image whose length after converting to bytes was aroung 64k but at the receiving end it was received in batch of 1024.How to successfully transfer the image? 例如,我转移了一个图像,其转换为字节后的长度为64k,但在接收端,它是以1024的批量接收的。如何成功传输图像?

Is there any efficient way to transfer the image? 有没有有效的方式来传输图像?

Am I doing it the right way or not? 我是以正确的方式做到的吗?

Any help will be appreciated. 任何帮助将不胜感激。

好的还有一些如何成功传输图像:)仍然我不知道为什么图像是批量传输。问题部分是由于我的错误代码,缓冲区大小只初始化为1024字节。这就是为什么它的一个原因我正在重新初始化缓冲区到一个很大的价值,但是图像是批量接收但批量大的。最后我分批收集它们并重新排列以形成完整的图像。

here is the link which will able to make help you to transmit the image via Bluetooth 这是一个链接,可以帮助您通过蓝牙传输图像

http://developer.android.com/guide/topics/wireless/bluetooth.html#ConnectingDevices http://developer.android.com/guide/topics/wireless/bluetooth.html#ConnectingDevices

尝试使用intent并调用setType(“image / jpeg”),或png或您使用的任何图像文件格式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM