SafeAgs
- Bundle: A bundle is a combination of storage data types (list, stack, array, etc.) that can be converted between data types.
- When we want to send data from Fragment A to Fragment B, we have A problem. The data format of FRAGMENT A may become Null, 0, etc., or the data type of FRAGMENT A is not what THE fragment B wants, so we have safeArgs
- SafeArgs is a plugin for Gradle that generates code to ensure that the data types of two fragments match and simplify the passing process
- Steps:
-
Add dependencies to builde.gradle of project
classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:$navigationVersion"
-
Add plugin Statement to build.gradle(Module) of your app
apply plugin: 'androidx.navigation.safeargs' Copy the code
-
Intent & Sharing(Switching between Activities)
- Explicit Intent: Launch specific activity
- Implicit intent: specifiy WHAT you want done and system chooses activity
- Intent Action: Each Intent requires an Intent Action:
- describe the type of thing that is to be done
- Intent Data Type: Finds a matching app based on the Data Type
- All activities need to be in
androidManifest.xml
regist <intent-filter>
is used to expose that your activity can response to an implicit intent with a certain action, category or type
- All activities need to be in