Question: (a) Suppose there are three button objects in MainActivity.java as follows. It is planned to use Array list variable name button_arraylist to store three button

(a) Suppose there are three button objects in MainActivity.java as follows. It is planned to use Array list variable name button_arraylist to store three button objects as items. Write the java statements to show how button objects can be stored in array list. [10 marks] Button btn_a, btn_b, btn_c; (b) Suppose there are two buttons in activity_main. xml with id: btn 1 and btn 2 . Write the java program in MainActivity.java so that (1) initialize btn 1 \& btn2 (2) hide btn2 (3) when btn1 is clicked, btn1 hides and btn2 shows (4) when btn 2 is clicked, btn 2 hides and btn 1 shows again. [10 marks]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
