Spinner for Android development
<p>I have followed the guide on the android website to create a spinner. I have copied the code exactly but I still get the following errors:</p>

<blockquote>
  <p>Syntax error on token "setDropDownViewResource", Identifier expected
  after this token</p>
</blockquote>

<p>,</p>

<blockquote>
  <p>Syntax error on token ".", ... expected</p>
</blockquote>

<p>,</p>

<blockquote>
  <p>Syntax error on token(s), misplaced construct(s)</p>
</blockquote>

<p>,</p>

<blockquote>
  <p>Syntax error on token "adapter", VariableDeclaratorId expected after
  this token</p>
</blockquote>

<p>If anyone could help me to work out what these problems may be it would be most appreciated.</p>

<p>I have shown the code below. </p>

<pre><code>     package com.example.myfirstapp;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;



public class MainActivity extends Activity {
    public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE";
    public final static String EXTRA_MESSAGE_COLOR = "com.example.myfirstapp.MESSAGE2";



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }  


    Spinner spinner = (Spinner) findViewById(R.id.spinner);
 // Create an ArrayAdapter using the string array and a default spinner layout
 ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource(this,
         R.array.color_array, android.R.layout.simple_spinner_item);
 // Specify the layout to use when the list of choices appears
 adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
 // Apply the adapter to the spinner
 spinner.setAdapter(adapter);


/** Called when the user clicks the Send button */
public void sendMessage (View view)   {
    Intent i = new Intent(this, DisplayMessageActivity.class);
    EditText editText = (EditText) findViewById(R.id.edit_message);
    //EditText editTextcolor = (EditText) findViewById(R.id.edit_message_color);
    String message = editText.getText().toString();
    //String messagecolor = editTextcolor.getText().toString();
    Bundle extras = new Bundle();
    extras.putString(EXTRA_MESSAGE, message);
    //extras.putString(EXTRA_MESSAGE_COLOR, messagecolor );
    i.putExtras(extras);
    startActivity(i);

}}  
</code></pre>
