Only setting the background will cause the the origional color to appear every time you scroll - this could look really bad!! A simple way to fix this is to use "setCacheColorHint" In the OnCreate() method of your class: To set the background color of a ListView:
The code below prompts the user to enter some words. Stores the words in a string, counts the words then outputs the result. You can easily adjust the example below to read how many words are contained in a file or form.
The switch statement can have a number of possible execution paths and I find it very useful when doing android programming. The following code example, WeekDay, declares an integer named week whose value represents a week day. The code displays the name of the week day, based on the value of the week day number (int), using the switch statement.
Android Example: The switch statement is used to determine which option menu item was selected by the user. The corresponding Activity is then started.