Question 15 Suppose Application Mainactivity Class Associated Layout File Called Activitym Q28918825

Question 15

Suppose your application has a MainActivity class and anassociated layout file called ‘activity_main’. What is wrong withthe below code?

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.id.activity_main);}

setContentView() should reference the layout by name
should use findViewById(R.id.activity_main) instead
should use ‘res.id.activity_main’ instead
Layout should be invoked in the onStart() method instead

Question 16

In Android, an adapter serves the following purpose:

converts data collection items between data types
converts data collection items in views for display
converts XML data into Java data types
converts database collections to in-memory collections
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *