확인 당신이 당신의 활동에 브로드 캐스트 리시버를 만들 수 있습니다 당신이 할 수 있습니다. 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.
텍스트 뷰가 활동 스레드 – BobbelKL