Spinner


 

  1. Static Spinner
  2. Dynamic Spinner
  3. Spinner with Custom ArrayAdapters
  4. Spinner Customizing
  5. Spinner with Error Validation

 

1. Static Spinner

Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.

Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open src -> package -> MainActivity.java and add following code :

Step 4 : Open res -> values-> strings.xml and add following code :

Step 5 : Open AndroidManifest.xml and add following code :

ScreenShot:

spinner spinner2 spinner3

Download_button

 

2. Dynamic Spinner

Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.

Step 2 : Open src -> package -> MainActivity.java and add following code :

Step 3 : Open res -> values-> strings.xml and add following code :

Step 4 : Open AndroidManifest.xml and add following code :

ScreenShot:

dy_spinner dy_spinner2 dy_spinner3

Download_button

 

3. Spinner with Custom ArrayAdapters

Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.

Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open res -> layout -> Create new xml, spinner_item_row.xml and add following code :

Step 4 : Open src -> package -> MainActivity.java and add following code :

Step 5 : Open src -> package -> Create new class, CustomSpinnerAdapter.java and add following code :

Step 6 : Open AndroidManifest.xml and add following code :

ScreenShot:

spinner_custom_adapter spinner_custom_adapter2

Download SourceCode

 

4. Spinner Customising

Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.

Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open src -> package -> MainActivity.java and add following code :

Step 4 : Open src -> package -> Create new class, CustomSpinnerAdapter.java and add following code :

Step 5 : Open src -> package -> Create new xml, custom_spinner_background.xml and add following code :

Step 6 : Open AndroidManifest.xml and add following code :

Step 7 : Open build.gradle(Module: app) and add following code :

ScreenShot:

spinnercustomisingspinnercustomising2

Download SourceCode

 

 

5. Spinner with Error Validation

Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.

Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open src -> package -> MainActivity.java and add following code :

Step 4 : Open AndroidManifest.xml and add following code :

Step 5 : Open build.gradle(Module: app) and add following code :

ScreenShot:

spinnervalidationspinnervalidation2

Download SourceCode