Spinner

Xml: 


import android.widget.Spinner;

Spinner spinner = (Spinner) findViewById(R.id.projectSpinner);

List categories = new ArrayList();
        categories.add("");
        categories.add("T ES");
        categories.add(" T STL");
        categories.add("T S");


        // Creating adapter for spinner
        ArrayAdapter dataAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, categories);

        // Drop down layout style - list view with radio button
        dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

        // attaching data adapter to spinner
        spinner.setAdapter(dataAdapter);
         // Spinner click listener
        spinner.setOnItemSelectedListener(this);

    @Override
    public void onItemSelected(AdapterView parent, View view, int position, long id) {
        // On selecting a spinner item
        String item = parent.getItemAtPosition(position).toString();

        // Showing selected spinner item
        if(item != "") {
            Toast.makeText(parent.getContext(),
                    "OnItemSelectedListener : " + parent.getItemAtPosition(position).toString(),
                    Toast.LENGTH_SHORT).show(););
      }
   }
@Override
  public void onNothingSelected(AdapterView arg0) {
	// TODO Auto-generated method stub
  }