Read a text value and spinner value
<p>I have the following MainActivity.java file currently running on Eclipse.</p>

<p>My intention is to get the user input and the spinner value and form a url like <code>www.ex.com?title=(user_inpu)&amp;title_type=(spinner_input)</code>.</p>

<p>As of now I am hung on this part. How do I get the text value from EditText and Spinner?</p>

<p>I have tried writing this code:</p>

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

import org.apache.commons.logging.Log;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;

public class MainActivity extends Activity {

Button btn;
EditText edit;

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

    btn = (Button) findViewById(R.id.button);
    edit = (EditText) findViewById(R.id.edit_message);

    btn.setOnClickListener(
            new View.OnClickListener()
            {
                public void onClick(View view)
                {
                    Log.v("EditText", edit.getText().toString());
                }
            });


Spinner spinner = (Spinner) findViewById(R.id.spinner);
ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource(this,R.array.title_type,android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);

spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
    public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int pos, long id) {
        Object item = parent.getItemAtPosition(pos);
    }
    public void onNothingSelected(AdapterView&lt;?&gt; parent) {
    }
});

}


}
</code></pre>

<p>I am getting a small error:</p>

<blockquote>
  <p>The method v(string, String) is undefined for MainActivity.java.</p>
</blockquote>

<p>I have tried replacing the <code>Log.v("EditText", edit.getText().toString());</code> to <code>Log.v("EditText", MainActivity.this.edit.getText().toString());</code>, but the error still persists.</p>

<p>How do I get rid of that? And in general, will this code work?</p>
