Search Results

Search found 1 results on 1 pages for 'neos300'.

Page 1/1 | 1 

  • Force close on clicking on radio button

    - by neos300
    Whenever I try to press a radio button on my emulator, it just force closes! public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button b = (Button)this.findViewById(R.id.btn_confirm); b.setOnClickListener(this); RadioButton radio_ctf = (RadioButton) findViewById(R.id.radio_ctf); RadioButton radio_ftc = (RadioButton) findViewById(R.id.radio_ftc); radio_ctf.setOnClickListener(this); radio_ftc.setOnClickListener(this); } @Override public void onClick(View v) { TextView tv = (TextView)this.findViewById(R.id.tv_result); EditText et = (EditText)this.findViewById(R.id.et_name); RadioButton radio_ctf = (RadioButton) findViewById(R.id.radio_ctf); RadioButton radio_ftc = (RadioButton) findViewById(R.id.radio_ftc); double y = 0; int x = Integer.parseInt(et.getText().toString()); if(radio_ctf.isChecked()) { y = ((double)x * 1.8) + 32; } if(radio_ftc.isChecked()) { y = ((double)x - 32) * 0.555; } String text = "Result:" + y; tv.setText(text);

    Read the article

1