안드로이드 개발 질문/답변
(글 수 45,052)
안녕하세요.
Activity 에서 Service를 하나 실행하려 합니다.
Service 실행시에는 Intent로 데이타를 넣어서 전달 해주려 하는데.
아래와 같이 해주고 있습니다.
Object obj = UiHandler;
GlobalParcelable gp = new GlobalParcelable(obj);
Bundle b = new Bundle();
b.putParcelable("test", gp);
Intent intent = new Intent(this, Background.class);
// intent.putExtras(b); <- 주석 풀면 에러 발생.
mService = startService(intent);주석 처리 된 부분에서
InvocationTargetException
에러가 발생합니다.
주석처리 후 실행하면 정상적으로 Service가 실행이 됩니다.
(parcelable에서도 정상적으로 변수에 값이 들어가는 것을 확인했습니다)
혹시 왜 이러는지 아시는 분 계신가요?




public Intent putExtras (Bundle extras)
Add a set of extended data to the intent. The keys must include a package prefix, for example the app com.android.contacts would use names like "com.android.contacts.ShowAll"
Bundle의 경우에는 bundle의 모든 key가 package prefix를 붙여야 된다고 되어 있네요