title: Link two Spinner with a button
body: <p>I want the user to do this: when they select an item from the first spinner and the item on the other spinner and click on the button they get the result in a <code>TextView</code>. How can I do that? </p>
  
  <p>I created already two spinner , <code>TextView</code> and one button. For example: if the user select from the first spinner their name and the second spinner their id, when they click to the button the text view will show their telephone number .</p>
  
  <p>UPDATE:</p>
  
  <p>Here is the code for the MainActivity </p>
  
  <pre><code>package second.program.p1;
  
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.ArrayAdapter;
  import android.widget.Button;
  import android.widget.Spinner;
  import android.widget.AdapterView;
  import android.widget.TextView;
  import android.widget.Toast;
  
  
  public class MainActivity extends AppCompatActivity {
  
  Spinner v1;
  Spinner v2;
  ArrayAdapter&lt;CharSequence&gt; adapter;
  TextView T1;
  Button b;
  
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      v1 = (Spinner) findViewById(R.id.v1);
      adapter = ArrayAdapter.createFromResource(this,R.array.city_names,android.R.layout.simple_spinner_item);
      adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      v1.setAdapter(adapter);
      v1.getSelectedItemPosition();
  
  
  
      v2 = (Spinner) findViewById(R.id.v2);
      adapter = ArrayAdapter.createFromResource(this,R.array.city_names,android.R.layout.simple_spinner_item);
      adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      v2.setAdapter(adapter);
  
  
  
      T1 = (TextView) findViewById((R.id.T1));
  
      b = (Button) findViewById(R.id.b);
  
  
  
  
  
  }
      };
  </code></pre>
  
  <p>Strings.xml</p>
  
  <pre><code>&lt;resources&gt;
  &lt;string name="app_name"&gt;P1&lt;/string&gt;
  &lt;string-array name="city_names"&gt;
      &lt;item&gt;" "&lt;/item&gt;
      &lt;item&gt;"Med"&lt;/item&gt;
      &lt;item&gt;"Ryu"&lt;/item&gt;
      &lt;item&gt;"Jedd"&lt;/item&gt;
      &lt;item&gt;"Hai"&lt;/item&gt;
  &lt;/string-array&gt;
  &lt;/resources&gt;
  </code></pre>
  
  <p>So , i want after the user select "Med" from the first spinner (v1) and "Hai" from the second spinner (v2) he press the Button ,after that in the <code>TextView</code> will appers the km (the distance between the two cites, but i dont add it yet)</p>
  
  <p>i did the two spinners ,
  now what i should do with the <code>TextView</code> and the <code>Button</code> ?</p>