【发布时间】:2021-07-02 14:18:25
【问题描述】:
我的应用程序从蓝牙接收数据,并将其存储在 Java(本机)中的变量中。我可以在 toast 消息中显示。需要将值移动到颤动 我必须在 initstate 中显示颤振中的值。谁能帮我? 我的处理程序。
handler = new Handler(Looper.getMainLooper()){
@Override
public void handleMessage(Message msg){
if(msg.what == MESSAGE_READ){
readMessage = null;
try {
readMessage = new String((byte[]) msg.obj, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
Toast.makeText(getApplicationContext(),"MEssage"+readMessage,Toast.LENGTH_LONG).show();
}
if(msg.what == CONNECTION_STATUS){
if(msg.arg1 == 1)
{
bluetoothStatus=true;
result.success(bluetoothStatus);
}
else
{
bluetoothStatus=false;
result.success(bluetoothStatus);
}
}
}
};
【问题讨论】:
标签: java android flutter native