Fragments and Navigation Components

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/18

flashcard set

Earn XP

Description and Tags

Flashcards for lecture notes on Fragments and Navigation Components in Android app development.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

19 Terms

1
New cards

Fragment

A block of UI with its own lifecycle that can be reused within different activities, allowing developers to create modular user-interface components that can change based on screen size and orientation.

2
New cards

Fragment object

It is somewhere between a View and an Activity. Like a View, it can be added to a ViewGroup or be part of a layout, but unlike an Activity, it is not a Context, and its life cycle depends on that of the Activity to which it belongs.

3
New cards

onInflate

Fragment lifecycle method called only to define a fragment directly in the layout using the tag, saving configuration parameters and attributes defined in the XML layout file.

4
New cards

onAttach

Fragment lifecycle method called as soon as the fragment is attached to the father activity, used to store the reference about the activity.

5
New cards

onCreate

Fragment lifecycle step where the fragment is in the creation process, used to start threads to retrieve data, possibly from a remote server.

6
New cards

onCreateView

Fragment lifecycle method called when the fragment has to create its view hierarchy. During this method, layout will be inflated inside the fragment, but it is not sure that the activity is still created.

7
New cards

OnActivityCreated

Fragment lifecycle method that notifies when the father activity is created and ready for use. From here, the activity is active and created and can be used when needed.

8
New cards

onStart

Fragment lifecycle phase where the fragment is visible but not yet interacting with the user, similar to the activity's onStart.

9
New cards

onResume

Fragment lifecycle method called when the fragment is ready to interact with the user. At the end of this phase, the fragment is up and running.

10
New cards

onPause()

Similar to Activity.onPause()

11
New cards

onDestroyView()

Final fragment cleaning up. It is called if the OS decides to destroy the fragment view.

12
New cards

onDestroy()

Fragment lifecycle method where all active connections should be released because the fragment is close to shutting down.

13
New cards

onDetach

Fragment lifecycle method that detaches the fragment from the activity.

14
New cards

onStop()

Called when the fragment is no longer visible

15
New cards

FragmentManager

A component in the Activity used to handle fragments, allowing fragments to be added, removed, or replaced at runtime. A transaction is needed to activate any operations on a fragment.

16
New cards

Navigation

The interactions that allow users to navigate across, into, and back out from the different pieces of content within your app.

17
New cards

Navigation graph

An XML resource file that contains all navigation-related information in one centralized location, including destinations and the possible paths a user can take through the app.

18
New cards

NavHost

An empty container that displays destinations from your navigation graph. It contains a default NavHost implementation, NavHostFragment, that displays fragment destinations.

19
New cards

NavController

An object that manages app navigation within a NavHost, orchestrating the swapping of destination content as users move throughout your app.