http://groups.google.com/group/android-developers/browse_thread/thread/d97938299660f501/8afafd1b56e646e2?lnk=raot
http://www.mail-archive.com/android-developers@googlegroups.com/msg34374.html
위 문제의 해결책

TabActivity 안에 Tab Content로 A Activity 가 있다고 할때
어떤 Caller Activity에서 startActivityOnResult() 로 TabActivity를 호출한 뒤
A Activity에서 아래와 같이 종료하면 (TabActivity가 종료됨)

setResult(RESULT_OK, intent);
finish();

위와 같이 RESULT_OK 로 넘겨줘도
TabActivity 를 호출한 Caller Activity에서 resultCode 가 항상 RESULT_CANCELED 로 넘어온다

이 문제는 의외로 쉽게 해결 할 수 있다.
A Activity를 종료하는 코드에서 부모 Activity를 얻어와서 (여기선 TabActivity 가 된다)
부모에도 result를 설정해 주면 된다.

setResult(RESULT_OK, intent);
Activity tab = getParent();
tab.setResult(RESULT_OK, intent);
finish();

이건 의도한 것인지.. 버그인 것인지... -ㅅ-;;

저작자 표시 비영리 변경 금지
Posted by 유야
TAG ,

댓글을 달아 주세요

  1. mSurfLab 2010/01/20 10:56  댓글주소  수정/삭제  댓글쓰기

    제가 고민고민던것을 정확히 집어주셨군요. 감사합니다.

  2. 나항상일등 2010/08/20 14:28  댓글주소  수정/삭제  댓글쓰기

    저도 고민하고 있었는데 감사합니다. ^^