

In this file, we use the TextView and Spinner widgets and also set their attributes. Used to specify the gravity of the view like center, top, bottom etc Used to the text alignment in the dropdown list.

How to Send Data From One Activity to Second Activity in Android?.

How to Change the Background Color of Button in Android using ColorStateList?.Kotlin | Lambdas Expressions and Anonymous Functions.Dynamic CheckBox in Android with Examples.Android | How to add Radio Buttons in an Android Application?.ISRO CS Syllabus for Scientist/Engineer Exam.ISRO CS Original Papers and Official Keys.GATE CS Original Papers and Official Keys.Maintaining same order in both arrays let us to directly map the image of selected animal based on the position selected in the Spinner. The String array is used to store the names of animals and the int array is used to store the drawable id of their images. Public class MainActivity extends ActionBarActivity Note that there are two arrays in MainActivity. Modify the MainActivity.java according to the following code. Notice that there is a UI component Spinner which is the combo box used to display some names of animals. Modify the activity_main.xml as shown below.
