-1

グループに 3 つのラジオ ボタンがあり、ラジオ ボタンのクリックでインテントを呼び出したいのですが、ラジオ ボタンをクリックすると例外が発生し、どのような例外が発生しているかを知ることができません。

これが私のコードです。

public class Contentstory extends Activity {

    RadioButton Child,Adult,Animated ;
    RadioGroup radiogroup1;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.content);

        radiogroup1 = (RadioGroup) findViewById(R.id.radioGroup1);
        final RadioButton Child = (RadioButton)findViewById(R.id.radio0);

       radiogroup1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {

            public void onCheckedChanged(RadioGroup group, int checkedId) {

                if (Child.isChecked()){

        Intent intent = new Intent(getApplicationContext(),StoryList.class);
        Contentstory.this.startActivity(intent);


                }


            }

        });   

http://i.stack.imgur.com/c9bqe.jpg

4

1 に答える 1

0
  1. 電話する必要はありませんradiogroup1 = (RadioGroup) findViewById(R.id.radioGroup1);

  2. コードにエラーが表示されていないため、ラジオボタンのIDを正しく確認してください。

  3. 例外を投稿すると、ID の何が問題なのかを確認できますか?

于 2011-08-02T09:57:53.663 に答える