I have created the bases for an Android app that asks a user a set of questions; linked to diabetes symptoms,and produces a diabetic status based on the user's answers. However I am having trouble with creating a point system to produce the diabetic states.
The app asks 11 questions (on separate activities) that only 7 are relevant to diabetic symptoms. Each question's answers are within a RadioGroup and I have managed to produce a toast to show which has been selected (my own testing use). I would like to give each RadioButton (answer) a number value so that for instance if a user scores above 10 then they are diabetic. Can anyone help??
RadioGroup sample code within one of the activity's .java file:
final RadioGroup radioDQ1Group = (RadioGroup) findViewById(R.id.radioDQ1Group1);
Button btnNext = (Button) findViewById(R.id.btnNext1);
btnNext.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(Diabetes_Question_1.this, Diabetes_Question_3.class));
// get selected radio button from radioGroup
int selectedId = radioDQ1Group.getCheckedRadioButtonId();
// find the radio button by returned id
RadioButton radioDQ1Button = (RadioButton) findViewById(selectedId);
Toast.makeText(Diabetes_Question_1.this, radioDQ1Button.getText(), Toast.LENGTH_SHORT).show();
}
});
I would like each activity's score to be sent to the next activity or saved globally within the app so that once a 'Calculate' button is pressed the app will total the score and show the user another activity stating their potential diabetic states. Can anyone help ASAP as my deadline is tight?? Any help will be greatly appreciated!!