スレッド内でループを試すことができますが、あなたの活動にブロードキャストレシーバを作成することができます。 oncreateにこのコードを書いてください。実際に私は自宅にいるので、あなたはそれを修正する必要があります私はあなたにアイデアを与えているそれを修正します。
BroadcastReciever broadcast_obj = new BroadcastReciever (
@overrieded
onRecieve(Intent intent) {
String action = intent.getAction();
if(action == "my_bt_action") {
//UPDATE YOUR TEXTVIEW AND DO WHATEVER WORK YOU WANT.
}
});
Now you need to register your broadcast for that just put these line in your oncreate after creating Broadcast reciever which we have just done.
registerREciever(broadcast_obj, new IntentFilter("my_bt_action");
now you need to send your broadcast when your service will perform your calculation or your task for that it is simple.
Intent intent = new Intent (getApplictionContext,"my_bt_action");
sendBroadcast(intent);
from above code you can easily communicate between your activity and service.
hope it will work.
この文句を言わない仕事、TextViewには活動スレッド – BobbelKL