Android
OA0-002 · Question #56
The following code applies to a dialog layout defined in XML. Which is the correct code that goes into (1)? (Assume the dialog layout is correctly defined in res/layout/custom_dialog.xml, and there…
The correct answer is B. dialog.setContentView(R.layout.custom_dialog). See the full explanation below for the reasoning.
Question
The following code applies to a dialog layout defined in XML. Which is the correct code that goes into (1)? (Assume the dialog layout is correctly defined in res/layout/custom_dialog.xml, and there are no other problems in the rest of the application.)
Options
- Adialog.inflate(R.layout.custom_dialog);
- Bdialog.setContentView(R.layout.custom_dialog);
- Cdialog.getinflate().inflate(R.layout.custom_dialog);
- Ddialog.setLayout(R.layout.custom_dialog);
How the community answered
(60 responses)- A5% (3)
- B83% (50)
- C10% (6)
- D2% (1)
Community Discussion
No community discussion yet for this question.