[Android]/학습
[Android/Kotlin] 안드로이드 학습 3.3 - 외부 활동
Cocoa's Story
2022. 11. 9. 04:59
학습과정 3번에서의 게임 결과를 다른 앱으로 보내고 친구와 공유해보자.
Android Kotlin Fundamentals: 03.3 Start an external Activity | Android Developers
In this codelab, you learn how to pass parameters to a Fragment using safe args to make debugging your app easier, and how to invoke an external Activity in an app.
developer.android.com
Bundle
- key - value 형태의 저장소.
- directory 또는 associative array라고도 불림
- 고유 키(문자열)를 사용하여 해당 키와 관련된 값을 가져오는 데이터 구조
- Bundle를 활용해 Fragment끼리 데이터를 전달받을 수 있음
1. 프로젝트에 Safe Args 추가
build.gradle(Project)에서 종속성 추가
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigationVersion"
build.gradle(Module)에서
apply plugin: 'androidx.navigation.safeargs'