Bom queria saber, como posso somar essa (intent) e como printa-la no fim do programa em outra Classe.
public class Main2Activity extends AppCompatActivity implements View.OnClickListener{
int points = 0;
Button next;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
next = (Button) findViewById(R.id.next);
next.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.option1:
points = points + 0;
break;
case R.id.correctly:
points = points + 1;
break;
case R.id.option3:
points = points + 0;
break;
case R.id.option4:
points = points + 0;
break;
case R.id.option5:
points = points + 0;
break;
}
if (next.isPressed()) {
Intent intent = new Intent(this, Main3Activity.class);
intent.putExtra("pontuação", points);
startActivity(intent);
apply(intent);
}
}
}