The method that connects an XML layout file to an activity is:

  1. findViewById()
  2. setContentView()
  3. inflateMenu()
  4. startActivity()
Answer

B) setContentView()

setContentView(R.layout.activitymain) inflates the layout as the activity's UI.

Computer Science MCQ · More Lab: Android Studio Setup and First App MCQs · Practise