| Attribute | Value |
|---|---|
| id | txt_brands |
| layout_height | wrap_content |
| layout_width | wrap_content |
| layout_margin | 16dp |
| text | |
| textSize | 24sp |
| Attribute | Value |
|---|---|
| id | txt_brands |
| layout_height | wrap_content |
| layout_width | wrap_content |
| text | Find Beer |
| padding | 16dp |
| textSize | 24sp |
| textAllCaps | false |
| Attribute | Value |
|---|---|
| id | spnr_beer_color |
| layout_height | wrap_content |
| layout_width | match_parent |
| layout_margin | 16dp |
<string-array name="beer_colors">
<item>blond</item>
<item>amber</item>
<item>brown</item>
<item>dark</item>
</string-array>
The resulting strings resource file:android:entries="@array/beer_colors"
public void findBeer(View view) {
// body to be added later.
}
android:onClick="findBeer"
| Input | Return Value |
|---|---|
| blond | [Glacier Eisbock, Dogfish Head Piercing Pilsner, Maui Bikini Blonde, Free State Oktoberfest] |
| amber | [Fat Tire Amber Ale, Hop Head Red, Bell\'s Amber Ale, Flipside Red IPA] |
| brown | [Sweetwater Georgia Brown, Brooklyn Brown Ale, Newcastle Brown Ale, Founders Sumatra Mountain Brown] |
| dark | [Sumi Zest, Beer for Breakfast, Sweet Baby Jesus!, Speedway Stout] |
TextView txtBrands = findViewById(R.id.brands); Spinner spnrColor = findViewById(R.id.beer_color);
String beerType = spnrColor.getSelectedItem( ).toString( );