Vidyalelo
Computer Science · Q176

Kotlin Programming MCQ for Competitive Exams, Interviews, and Certifications

Engineering and GATE · Computer Science · question 176

Q176

Where do you set the ID of a fragment to be used in navigation?

A.
In the fragment layout file, either by setting the ID attribute in the design editor or in the layout XML file in the res > layout folder.
B.
In the project navigation file, either by setting the ID attribute in the navigation graph or in the navigation.xml file in the res > navigation folder.
Answer
C.
You need to set the ID in both the navigation file for the app and the layout file for the fragment.
D.
Set the ID variable in the relevant Fragment class.

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board