title: My program crashes and I don't know why
body: <p>I'm learning how to program in Java for Android and my program keeps crashing.   It's suppoesed to convert from Celsius to Fahrenheit.</p>
  
  <pre><code>package com.example.myapplication;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.RadioButton;
  import android.widget.RadioGroup;
  import android.widget.Toast;
  import android.widget.RadioGroup.OnCheckedChangeListener;
  
  
  public class MainActivity extends Activity implements RadioGroup.OnCheckedChangeListener 
  {
  
  public static final int MY_CODE=2;
  EditText temp;
  RadioButton converttoF,converttoC,selectedtype;
  RadioGroup conversion;
  
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState)
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      conversion = (RadioGroup)findViewById(R.id.conversion);
      conversion.setOnCheckedChangeListener(this);
      converttoF = (RadioButton)findViewById(R.id.converttoF);
      converttoC = (RadioButton)findViewById(R.id.converttoC);
  
  
  
  
  }
  
  @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;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      // Handle action bar item clicks here. The action bar will
      // automatically handle clicks on the Home/Up button, so long
      // as you specify a parent activity in AndroidManifest.xml.
      int id = item.getItemId();
      if (id == R.id.action_settings) {
          return true;
      }
      return super.onOptionsItemSelected(item);
  }
  
  @Override
  public void onCheckedChanged(RadioGroup group, int checkedId)
  {
      selectedtype = (RadioButton) findViewById(checkedId);
  
      Intent i = new Intent(this, Activity4Result.class);
      i.putExtra("temper", temp.getText().toString());
  
      if(selectedtype.equals(converttoC))
      {
          Toast.makeText(this,"C chosen", Toast.LENGTH_SHORT).show();
          i.putExtra("type", 'c');
          startActivityForResult(i, MY_CODE);
      }
  
      else
      {
          Toast.makeText(this,"F chosen", Toast.LENGTH_SHORT).show();
          i.putExtra("type", 'f');
          startActivityForResult(i, MY_CODE);
      }       
    }       
  }
  </code></pre>
  
  <p>My guess is that the problem is happening in the "onCheckedChanged", because it crashes when I push any RadioButton.</p>