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) ;
}
Correct Answer:
Verified
Q17: Q18: What do you want from Room when Q19: To run your local unit tests, follow Q20: When your code execution reaches the breakpoint, Q21: When scheduling unique work, you must tell Q23: Building your app from the command line, Q24: Interface for a callback to be invoked Q25: What is the incorrect statement about Data Q26: What statements about InputStreamReader (java.io.InputStreamReader) are correct? Q27: If constant LENGTH_INDEFINITE is used as a
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents