[Android] Adapter에서 양방향 통신 - ActivityResultLauncher

원준·2023년 7월 20일

Android Studio

목록 보기
24/40

사용 코드

  • adapter에서 코드를 변경하고 Main에서 launcher에서 받는 코드에 관련해서 이전과 똑같이 작성하면 정상 작동 된다.
// context자체는 Mainactivity인지 모른다.
// 지정을 함으로써 사용할 수 있게 변환을 해주고, launcher를 실행시킨다.
((MainActivity) context).launcher.launch(intent);
profile
공부해보자

1개의 댓글

comment-user-thumbnail
2023년 7월 20일

덕분에 좋은 정보 얻어갑니다, 감사합니다.

답글 달기