New Year Sale Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: simple70

Google Developers Certification - Associate Android Developer (Kotlin and Java Exam) Associate-Android-Developer Question # 38 Topic 4 Discussion

Google Developers Certification - Associate Android Developer (Kotlin and Java Exam) Associate-Android-Developer Question # 38 Topic 4 Discussion

Associate-Android-Developer Exam Topic 4 Question 38 Discussion:
Question #: 38
Topic #: 4

The easiest way of adding menu items (to specify the options menu for an activity) is inflating an XML file into the Menu via MenuInflater. With menu_main.xml we can do it in this way:


A.

@Override

public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); return true;

}


B.

@Override

public boolean onOptionsItemSelected(MenuItem item) {

getMenuInflater().inflate(R.menu.menu_main, menu);

return super.onOptionsItemSelected(item);

}


C.

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.menu.menu_main);

}


Get Premium Associate-Android-Developer Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.