2011년 2월 14일 월요일

service intent 호출

서비스에서

Intent intent = new Intent(mService.this, intentShow.class);
startActivity(intent);

방법 알고 계신분 해결방법좀 알려주세요~

public class mService extends Service {

@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}

@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();

Intent intent = new Intent(mService.this, intentShow.class);
startActivity(intent);

}

Service 에서 Activity 를 Launch 하기 위해서는 FLAG_ACTIVITY_NEW_TASK 를 사용하셔야 합니다. (기존에 존재하는 Task가 없음으로...)


Intent intent = new Intent(mService.this, intentShow.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

댓글 없음: