JonasQuist
Lurker
So i am programming a Quiz app for a school program, The app has 10 pages with a question on each.
On the question pages i have a next button, and back button, a textView and a radioGroup with 4 radioButtons. I want my code to be able to hold the data, so that if say 1 question is answered with the 3rd. radiobutton the app holds this data while i continue to the next page.
This is the Jave code [
public class Question1 extends Activity {
[HIGH]public void onCreate1(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_question1);
((RadioGroup) findViewById(R.id.radio_group))
.setOnCheckedChangeListener((OnCheckedChangeListener) this);
}
public void onCheckedChanged(RadioGroup radioGroup, int checkedId) {
switch (checkedId) {
case R.id.first_radio_button:
break;
case R.id.second_radio_button:
break;
case R.id.third_radio_button:
break;
case R.id.fourth_radio_button:
break;
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.question1, menu);
return true;
}
}[/HIGH]
and this is the XML
[HIGH] <RadioGroup
android:id="@+id/radio_group"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="40dp"
android
rientation="vertical" >
<RadioButton
android:id="@+id/first_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android
addingLeft="40dip"
android:text="@string/Ans1" />
<RadioButton
android:id="@+id/second_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android
addingLeft="40dip"
android:text="@string/Ans2" />
<RadioButton
android:id="@+id/third_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android
addingLeft="40dip"
android:text="@string/Ans3" />
<RadioButton
android:id="@+id/fourth_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android
addingLeft="40dip"
android:text="@string/Ans4" >
</RadioButton>
</RadioGroup>[/HIGH]
Any idea how i could make it happend? or general pointers on the app, this is my very first Android and Java protject
Regards Jonas
On the question pages i have a next button, and back button, a textView and a radioGroup with 4 radioButtons. I want my code to be able to hold the data, so that if say 1 question is answered with the 3rd. radiobutton the app holds this data while i continue to the next page.
This is the Jave code [
public class Question1 extends Activity {
[HIGH]public void onCreate1(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_question1);
((RadioGroup) findViewById(R.id.radio_group))
.setOnCheckedChangeListener((OnCheckedChangeListener) this);
}
public void onCheckedChanged(RadioGroup radioGroup, int checkedId) {
switch (checkedId) {
case R.id.first_radio_button:
break;
case R.id.second_radio_button:
break;
case R.id.third_radio_button:
break;
case R.id.fourth_radio_button:
break;
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.question1, menu);
return true;
}
}[/HIGH]
and this is the XML
[HIGH] <RadioGroup
android:id="@+id/radio_group"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="40dp"
android
rientation="vertical" ><RadioButton
android:id="@+id/first_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android
addingLeft="40dip"android:text="@string/Ans1" />
<RadioButton
android:id="@+id/second_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android
addingLeft="40dip"android:text="@string/Ans2" />
<RadioButton
android:id="@+id/third_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android
addingLeft="40dip"android:text="@string/Ans3" />
<RadioButton
android:id="@+id/fourth_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android
addingLeft="40dip"android:text="@string/Ans4" >
</RadioButton>
</RadioGroup>[/HIGH]
Any idea how i could make it happend? or general pointers on the app, this is my very first Android and Java protject

Regards Jonas