안녕하세요.
안드로이드에서 A라는 메시지가 발생하면 현재 특정activity(setup wizard)가 떠있는지 status를 체크하다가 특정activity가 끝나면 B라는 activity가 뜨도록 하는 프로그램을 짜야합니다. 우선 thread를 이용해서 1초단위로 특정activity 체크를 하다가 비로소 그 화면이 끝나면 B Activity가 뜨도록 만들었는데요. thread 종료 시점을 어떻게 넣어야 할지 모르겠어서요..
switch(msg.what)
case A: //A라는 메시지 발생
{
backthread thread = new backthread();
thread.setDaemon(true);
thread.start();
}
class backThread extends Thread{
public void run(){
while(true)
if(특정Task가 떠있다면 true반환하는 함수 호출)
thread.sleep();
continue; //특정activity(setup wizard) 떠 있다면 while문 다시 시작
else
startActivity(B Aciivy);
}
}
우선 이런식으로 해놨는데..
이 스레드는 계속 돌고 있는건가요?
B activity를 start시키고 종료되어야 하는데요..
원래는 TimerTask로 해보려다가 schedule.cancel해야할 부분을 어디다 넣어야 할지 모르겠어서 Thread를 이용했어요..
도와주세요!!!!