title: Unable to determine spinner value
body: <p>I have been on here for over an hour now reading related questions, but have not yet found a solution that fixes my issue, so I will ask. </p>
  
  <p>I have a Spinner. I would like to use the selected city in that spinner to set a latitude and longitude variable. I am unable to figure out how to either directly call that information, or to make it set into a variable when the "use this city" button is clicked. Here is the code I have so far. </p>
  
  <p>strings.xml</p>
  
  <pre><code>&lt;string-array name="locations"&gt;
      &lt;item &gt; Washington D.C. &lt;/item&gt;      
      &lt;item &gt;New York, NY&lt;/item&gt; 
      &lt;item &gt;Juneau, AL&lt;/item&gt;
      &lt;/string-array&gt;
  </code></pre>
  
  <p>MainActivity.java</p>
  
  <pre><code>    package cl.telematica.locationexample;
  
     import      cl.telematica.locationexample.interfaces.LocationListenerHandler;
     import cl.telematica.locationexample.location.ActiveLocationManagerActivity;
  
  
      import android.content.Intent;
      import android.location.Location;
      import android.os.Bundle;
      import android.view.Menu;
      import android.view.View;
  import android.view.WindowManager;
  import android.view.View.OnClickListener;
  import android.widget.ArrayAdapter;
  import android.widget.Button;
  import android.widget.Spinner;
  import android.widget.TextView;
  
  public class MainActivity extends ActiveLocationManagerActivity {
  
      public static String citylatitudText;
      public static String citylongitudText;
      public static TextView latitudText;
      public static TextView longitudText;
      public static String locationSet;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
  
          /*ArrayAdapter&lt;String&gt; adapter;
          locationSet = getResources().getStringArray(R.array.locations);
          adapter = new ArrayAdapter&lt;String&gt;(
                  this,
                  android.R.layout.simple_list_item_1,
                  locationSet);
  
           setListAdapter(adapter);*/
          Button b = (Button)findViewById(R.id.btnTestNoResults);
      Button c = (Button)findViewById(R.id.btnGPSSearch);
      Button d = (Button)findViewById(R.id.btnSetCity);
  
      final Spinner spinner = (Spinner)findViewById(R.id.spinner1);
      ArrayAdapter&lt;CharSequence&gt; location_adapter = ArrayAdapter.createFromResource(this, R.array.locations, android.R.layout.simple_spinner_item);
      location_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      spinner.setAdapter(location_adapter);
  
      //final String locationSet = spinner.getSelectedItem().toString();
      //final String locationSet = spinner.getItemAtPosition(spinner.getSelectedItemPosition()).toString();
     // spinner.setSelection(((ArrayAdapter&lt;String&gt;)spinner.getAdapter()).getPosition(locationSet));
  
      //final String locationSet = (String) spinner.getSelectedItem();
      b.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  // TODO Auto-generated method stub
                  startActivity(new Intent(MainActivity.this, NoResults.class));
              };
          });
          c.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  //if ()
                  // TODO Auto-generated method stub
                  startActivity(new Intent(MainActivity.this, NewSearch.class));
              };
          });
  
          d.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  if( locationSet == "Washington D.C.")
                  { citylatitudText = "38.9047 N";
                  citylongitudText = "77.0164 W";
                  }
  
                  else if (locationSet == "New York, NY")
                  {citylatitudText = "40.7127° N";
                  citylongitudText = "74.0059° W";            
                  }
                  else
                  {citylatitudText = "58.3000° N";
                  citylongitudText = "134.4167° W";           
                  }
  
                  // TODO Auto-generated method stub
                  startActivity(new Intent(MainActivity.this, NewSearch.class));
              };
          });
          latitudText = (TextView) findViewById(R.id.textView4);
          longitudText = (TextView) findViewById(R.id.textView5);
  
          listener = new LocationListenerHandler() {
              @Override
              public void OnLocationReceived(Location loc) {
                  latitudText.setText("" + loc.getLatitude());
                  longitudText.setText("" + loc.getLongitude());
              }
          };
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.main, menu);
          return true;
      }
  
  }
  </code></pre>
  
  <p>NewSearch.java</p>
  
  <pre><code>package cl.telematica.locationexample;
  
  import android.os.Bundle;
  import android.widget.TextView;
  import cl.telematica.locationexample.location.ActiveLocationManagerActivity;
  
  public class NewSearch extends ActiveLocationManagerActivity {
  
      public TextView citylat;
      public TextView citylong;
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_new_search);
          citylat = (TextView) findViewById(R.id.textView4);
          citylong = (TextView) findViewById(R.id.textView5);
          citylat.setText(""+ MainActivity.citylatitudText);
          //citylong.setText("" + MainActivity.citylongitudText);
          citylong.setText("" + MainActivity.locationSet);//testing to see if the city name selected by spinner is being put in variable form
  
  
      }
  
  }
  </code></pre>
  
  <p>When I click on the "use this city" button, I am getting the word "null" for the citylong variable on the NewSearch page, and "58.3000° N" for the citylat (so it is going to the "else" statement, regardless of what city I select). </p>
  
  <p>I know there are other posts about calling from a Spinner, and you can see where I have tried some of them and left them commented out in my code because they didnt work. </p>
  
  <p>I appreciate any help you can give. </p>