Android Development: How to Add an Auto Complete View

This tutorial shows you how to add a Country text field with an auto complete feature. Note, the default threshhold for autocomplete is 2, so you will need to enter two characters before autocomplete will recognize your input. You can download the below project.

1. AutoCompleteTextView is an implementation of the EditText widget that will provide auto-complete suggestions as the user types. The suggestions are extracted from a collection of strings.
2. Create a project
3. Open Main.xml and add an AutoCompleteTextView
4. Build project to update the R.java file
5. Add this code in OnCreate:

ArrayAdapter adapter = new ArrayAdapter(this,
android.R.layout.simple_dropdown_item_1line, COUNTRIES);
final AutoCompleteTextView autoCompleteTextView = (AutoCompleteTextView)

6. Add this code after OnCreate():

static final String[] COUNTRIES = new String[] {
"Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra",
"Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina",
"Armenia", "Aruba", "Australia", "Austria", "Azerbaijan",
"Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium",
"Belize", "Benin", "Bermuda", "Bhutan", "Bolivia",
"Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory",
"British Virgin Islands", "Brunei", "Bulgaria", "Burkina Faso", "Burundi",
"Cote d'Ivoire", "Cambodia", "Cameroon", "Canada", "Cape Verde",
"Cayman Islands", "Central African Republic", "Chad", "Chile", "China",
"Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo",
"Cook Islands", "Costa Rica", "Croatia", "Cuba", "Cyprus", "Czech Republic",
"Democratic Republic of the Congo", "Denmark", "Djibouti", "Dominica", "Dominican Republic",
"East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea",
"Estonia", "Ethiopia", "Faeroe Islands", "Falkland Islands", "Fiji", "Finland",
"Former Yugoslav Republic of Macedonia", "France", "French Guiana", "French Polynesia",
"French Southern Territories", "Gabon", "Georgia", "Germany", "Ghana", "Gibraltar",
"Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau",
"Guyana", "Haiti", "Heard Island and McDonald Islands", "Honduras", "Hong Kong", "Hungary",
"Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica",
"Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Kuwait", "Kyrgyzstan", "Laos",
"Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg",
"Macau", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands",
"Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia", "Moldova",
"Monaco", "Mongolia", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia",
"Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand",
"Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "North Korea", "Northern Marianas",
"Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru",
"Philippines", "Pitcairn Islands", "Poland", "Portugal", "Puerto Rico", "Qatar",
"Reunion", "Romania", "Russia", "Rwanda", "Sqo Tome and Principe", "Saint Helena",
"Saint Kitts and Nevis", "Saint Lucia", "Saint Pierre and Miquelon",
"Saint Vincent and the Grenadines", "Samoa", "San Marino", "Saudi Arabia", "Senegal",
"Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands",
"Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "South Korea",
"Spain", "Sri Lanka", "Sudan", "Suriname", "Svalbard and Jan Mayen", "Swaziland", "Sweden",
"Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "The Bahamas",
"The Gambia", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey",
"Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Virgin Islands", "Uganda",
"Ukraine", "United Arab Emirates", "United Kingdom",
"United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan",
"Vanuatu", "Vatican City", "Venezuela", "Vietnam", "Wallis and Futuna", "Western Sahara",
"Yemen", "Yugoslavia", "Zambia", "Zimbabwe"

Android Development: How To Add An Image Button

This application shows you how to add an imagebutton to your Android form and display a message using the Toast widget. A toast is a view containing a small message for the user. The toast class helps you create and show those. You can download the project file.

1. Create a new project
2. Open Main.xml in res/layout

3. Add a ImageButton to layout file main.xml

4. Set the Background property to an image in your project

5. Note the value for the imageButton ID

6. In ButtonActivity.java add the following code to the OnCreate() method. Make sure that R.id.ImageButton01 matches your imageButton’s ID.

final ImageButton button = (ImageButton) findViewById(R.id.android_button);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// Perform action on clicks
Toast.makeText(HelloFormStuff.this, "Beep Bop", Toast.LENGTH_SHORT).show();

7. Run application and select the image, “Beep Boo” message appears: Screen shot


How to Debug an Android Application in Eclipse

1.Select the ApplicationManifest.xml document in the project tree

2.In the AndroidManifest.xml UI select the Application Tab

3.In the Application tab set the Debuggable value to true

4.Run your project in debug by right clicking the project folder and selecting

5.Select the Dalvik Debug Monitor Server (DDMS) in the upper right corner

6.You should see your application in the Devices tab with a green debug icon next to it

7.The Debug Perspective will launch

Android Development: How to use Screen Capture

1.Start Eclipse
2.Plug Android device into USB port
3.Select the Dalvik Debug Monitor Server (DDMS) in the upper right.

4.In the Devices tab select the Screen Capture Icon

5.A screen capture of your device will appear!


Dark Development: Visual Studio and Vim settings

This video shows you how to import environment settings into Visual Studio 2005/2008. I am using a dark setting based on vibrant ink that was created by John Lam. I find that this setting helps reduce eye strain and it makes code much easier to read. If you want to import the same settings here is the Download Link.



Installing and Uninstalling Services

1. Open a Visual Studio Command prompt and change directory to where your project's compiled executable file is located.
2. Run InstallUtil.exe from the command line with your project's output as a parameter:

> installutil yourproject.exe

To uninstall your service manually

1.Run InstallUtil.exe from the command line with your project's output as a parameter. Enter the following code on the command line:

> installutil /u yourproject.exe


Oracle xe Backup and Restore for Windows


To dump a single schema to disk use this command

- Open a command prompt and navigate to the server\bin folder and execute this command:

exp user/password FIlE=schemaname.dmp OWNER=schemaname


imp user/password FIlE=schemaname.dmp

Avoiding SQL Injection Attacks

Some good links on avoiding SQL injection attacks:

How to read from the app.config file

Create your config file in Project->Properties->Settings. This will generate your app.config file. Next build your app. In the bin directory look for .exe.config . Use this exe.config file to update your app once it is deployed. I built a service, installed the service, then copied the exe.config file into the same directory.

To access app.config from code use: Settings.Default.