title: Android Studio multiple numbers with spinner selection
body: <p>So I'm attempting to have a spinner where you select a currency to convert to from GBP, enter a value in GBP and convert to the selected currency from the spinner by pressing a button. The converted value will then appear in the textview below</p>
  
  <p><a href="https://i.stack.imgur.com/PqGiL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PqGiL.png" alt="enter image description here"></a></p>
  
  <p>Here is the following code I have in the Convert activity i'm using, the app is crashing upon trying to switch to this layout from the main menu, however it was working before i tried adding the multiplication code. Thanks in advance.</p>
  
  <pre><code>public class Convert extends AppCompatActivity {
  
  
  final EditText currency_input = (EditText) findViewById(R.id.editText_currency_input);
  final TextView answer = (TextView) findViewById(R.id.textView_convert_to);
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.convert);
  
      Spinner spinner_convert_from = (Spinner) findViewById(R.id.spinner_convert_from);
      ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource(this,
              R.array.currency_array, android.R.layout.simple_spinner_item);
      adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      spinner_convert_from.setAdapter(adapter);
  }
  
  
  
  private void USD() {
      answer.setText(String.valueOf(Double.valueOf(String.valueOf(currency_input.getText()))*1.2798));
  }
  
  private void EUR() {
      answer.setText(String.valueOf(Double.valueOf(String.valueOf(currency_input.getText()))*1.14502));
  }
  
  private void AUD() {
      answer.setText(String.valueOf(Double.valueOf(String.valueOf(currency_input.getText()))*1.71911));
  }
  
  private void CAD() {
      answer.setText(String.valueOf(Double.valueOf(String.valueOf(currency_input.getText()))*1.7226));
  }
  
  private void JPY() {
      answer.setText(String.valueOf(Double.valueOf(String.valueOf(currency_input.getText()))*142.482));
  }
  
  private void CHF() {
      answer.setText(String.valueOf(Double.valueOf(String.valueOf(currency_input.getText()))* 1.24662));
  }
  
  private void CNY() {
      answer.setText(String.valueOf(Double.valueOf(String.valueOf(currency_input.getText()))* 8.7714));
  }
  
  private void KRW() {
      answer.setText(String.valueOf(Double.valueOf(String.valueOf(currency_input.getText()))*1430.8));
  }
  
  private void SEK() {
      answer.setText(String.valueOf(Double.valueOf(String.valueOf(currency_input.getText()))* 11.1187));
  }
  
  
  public class planOnClickListener implements AdapterView.OnItemSelectedListener {
      @Override
      public void onItemSelected(AdapterView&lt;?&gt; parent, View v, int pos,
                                 long id) {
          parent.getItemAtPosition(pos);
  
          if (pos == 0) {
              USD();
          } else if (pos == 1) {
              EUR();
          } else if (pos == 2) {
              AUD();
          } else if (pos == 3) {
              CAD();
          } else if (pos == 4) {
              JPY();
          } else if (pos == 5) {
              CHF();
          } else if (pos == 6) {
              CNY();
          } else if (pos == 7) {
              KRW();
          } else if (pos == 8) {
              SEK();
          }
      }
  
      @Override
      public void onNothingSelected(AdapterView&lt;?&gt; arg0) {
  
      }
  }
  </code></pre>
  
  <p>}</p>