Upgrade to Pro — share decks privately, control downloads, hide ads and more …

NSC AD 340 5210 - Week 5

Nate Ebel
May 10, 2020

NSC AD 340 5210 - Week 5

Nate Ebel

May 10, 2020


  1. What are we building this week? Building composable UI using

    Fragments 02 Project Demo Fragments 01
  2. Week 5 Project Updates • Create a LocationEntryFragment • Create

    a CurrentForecastFragment • Create an AppNavigator interface to navigate between fragments • Add a FloatingActionButton to show LocationEntryFragment after forecast data is displayed
  3. Fragment Has its own layout and lifecycle. Can be defined

    in XML or added/removed programmatically FragmentManager Manages what Fragments are currently showing on the screen. Use the FragmentManager to add/remove a Fragment. FragmentTransaction Represents the addition or removal of a single Fragment from its container. Fragments
  4. Fragment 1 Fragment 2 Fragment 3 Composable UI Add &

    remove multiple fragments in a single screen
  5. Fragment Lifecycle onAttach() Added to Activity onStart() Fragment is visible

    on screen onStop() Fragment no longer visible onCreateView() Fragment layout is inflated and returned onPause() Fragment has been removed onDestroyView() Fragment view is destroyed onResume() Fragment is active on screen onDetach() Fragment is removed from Activity