I have recently started looking into a bit more advanced Android development due to my needs. Starting with Navigation Component, I learned about a way to work with Fragments as well as possibility of passing data with SafeArgs
While I am able to understand and find information on how to pass data between different fragments, I am not finding any information on how to pass data from the actual Activity to the fragment.
Here is a short description of when I would need this:
<- Login Screen -> (Main activity) - NO FRAGMENTS, SIMPLE LOG-IN ACTIVITY
-- user enters data
-- clicks Log-in
-- Login successful
-- Saving and sending HTTP response data with other necessary information and transfering to Profile Page
<- Profile Page -> (ProfilePage Activity) with Drawer Layout that uses NavHostFragment to display different Fragments: [Profile Page], [Contact Info], [Payment Cards]
-- Profile Page Fragment
-- Extract data sent by Main Acitivity and use it to change values of ProfilePage Fragment TextViews
Here is where I face my problem - I have no idea how to pass data from the actual Activity to Fragment, especially when I know that there are so called SafeArgs that I only have a vague undestanding of.
Can someone please help me understand this better or at least point me in the right direction?