Sending data via Bluetooth with Android

和自甴很熟 提交于 2019-12-03 20:57:57
Jack

It seems that you have a synchronization issue. What I had to do in my class was implement a timer. The timer basically controls everything, it checks if BT is connected, if the network is connected, etc... But my activity required long running BT / network connections, I don't think yours does.

Why don't you add an isConnected() method to your MetawatchConnected class? After connection is complete, set it to true. Then you can:

if (mMetawatchConnected.isConnected())
{

    mMetawatchConnected.getBmp();
}

You will still have to deal with synchronization issues such as waiting for the initial connection, but I think you get the point.

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