I want to put my own score from first activity and I'm using a checkbox method. By selecting that checkbox, they have their own score which is one. After selecting that checkbox and press button next, it will go to the next activity which contain that score 1. Then the process in this second activity do the same as the first activity, but the only different is that the score must increase by 1. I will show my work on first activity below:
public class AfterNoYesQ1Activity extends AppCompatActivity {
Button buttonNext;
TextView textViewClickHere;
int score = 1;
CheckBox check1,check2,check3,check4,check5,check6,check7;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_after_no_yes_q1);
check1 = (CheckBox)findViewById(R.id.checkBox1);
check2 = (CheckBox)findViewById(R.id.checkBox2);
check3 = (CheckBox)findViewById(R.id.checkBox3);
check4 = (CheckBox)findViewById(R.id.checkBox4);
check5 = (CheckBox)findViewById(R.id.checkBox5);
check6 = (CheckBox)findViewById(R.id.checkBox6);
check7 = (CheckBox)findViewById(R.id.checkBox7);
buttonNext = (Button)findViewById(R.id.buttonNext);
buttonNext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(AfterNoYesQ1Activity.this, DetectionQues2Activity.class);
startActivity(intent);
}
});
textViewClickHere = (TextView) findViewById(R.id.textViewClickHere);
textViewClickHere.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(AfterNoYesQ1Activity.this, DetectionQues2Activity.class);
startActivity(intent);
}
});
}
public void checkone (View view)
{
if (check1.isChecked() && check5.isChecked() && check6.isChecked())
{
getIntent().putExtra("score",score);
}
else if (check1.isChecked() && check5.isChecked() && check7.isChecked())
{
//fail
getIntent().putExtra("score",score);
}
else if (check1.isChecked() && check6.isChecked() && check7.isChecked())
{
//fail
getIntent().putExtra("score",score);
}
else if (check2.isChecked() && check5.isChecked() && check6.isChecked())
{
//fail
getIntent().putExtra("score",score);
}
else if (check2.isChecked() && check5.isChecked() && check7.isChecked())
{
//fail
getIntent().putExtra("score",score);
}
else if (check2.isChecked() && check6.isChecked() && check7.isChecked())
{
//fail
getIntent().putExtra("score",score);
}
else if (check3.isChecked() && check5.isChecked() && check6.isChecked())
{
//fail
getIntent().putExtra("score",score);
}
else if (check3.isChecked() && check5.isChecked() && check7.isChecked())
{
//fail
getIntent().putExtra("score",score);
}
else if (check3.isChecked() && check6.isChecked() && check7.isChecked())
{
//fail
getIntent().putExtra("score",score);
}
else if (check3.isChecked() && check5.isChecked() && check6.isChecked())
{
//fail
getIntent().putExtra("score",score);
}
else if (check3.isChecked() && check5.isChecked() && check7.isChecked())
{
//fail
getIntent().putExtra("score",score);
}
else if (check1.isChecked() && check5.isChecked() && check6.isChecked())
{
}
else if (check3.isChecked() && check6.isChecked() && check7.isChecked())
{
//fail
}
else if (check1.isChecked() && check2.isChecked() && check5.isChecked())
{
//pass
}
else if (check1.isChecked() && check2.isChecked() && check6.isChecked())
{
//pass
}
else if (check1.isChecked() && check2.isChecked() && check7.isChecked())
{
//pass
}
else if (check1.isChecked() && check2.isChecked() && check3.isChecked() && check5.isChecked())
{
//pass
}
else if (check1.isChecked() && check2.isChecked() && check3.isChecked() && check6.isChecked())
{
//pass
}
else if (check1.isChecked() && check2.isChecked() && check3.isChecked() && check7.isChecked())
{
//pass
}
else if (check1.isChecked() && check2.isChecked() && check3.isChecked()
&& check4.isChecked() && check5.isChecked())
{
//pass
}
else if (check1.isChecked() && check2.isChecked() && check3.isChecked()
&& check4.isChecked() && check6.isChecked())
{
//pass
}
else if (check1.isChecked() && check2.isChecked() && check3.isChecked()
&& check4.isChecked() && check7.isChecked())
{
//pass
}
score = score + 1;
}
}