通过蓝牙在Android中传输图像 [英] Transfer an Image via Bluetooth in Android

查看:132
本文介绍了通过蓝牙在Android中传输图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个Android应用程序,需要的图像通过bluetooth.The图像尺寸要传输从一个Android设备到另一个云高达3至4 MB​​.The问题,我面临的是,当​​我发送图像的形式字节,该图像被接收在部分不是在单一伸展。对于如我转的图像,其长度转换成字节后aroung 64K,但在接收端就接收批量1024.How的成功传输的图像?

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

有传输的图像任何有效的方式?

Is there any efficient way to transfer the image?

我这样做是正确的方式或不?

Am I doing it the right way or not?

任何帮助将AP preciated。

Any help will be appreciated.

推荐答案

确定atlast一些如何成功发送的图像:)我仍然不知道为什么图像中batches.The问题转移部分原因是由于我的车code,缓冲区大小初始化仅适用于1024 bytes.That是一个原因,为什么它被发射的一批1024.I重新初始化缓冲区尽管如此,图像接收大size.Finally我收集的批次,但批量大的值他们分批和重新排列,以形成完整的图像。

OK atlast some how transmitted the image successfully:)Still I don't know why the images were transferred in batches.The problem was partially due to my buggy code,the buffer size was initialized only for 1024 bytes.That was one reason why it was transmitting in batch of 1024.I reinitialized buffer to a big value nonetheless the image was received in batches but batches of large size.Finally i collected them in batches and rearranged to form complete image.

这篇关于通过蓝牙在Android中传输图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆