简体   繁体   中英

How can I add results from textView in android studio?

Here is my code :

if(radioButton_correct1e.isChecked()) {
     score++;
     scoreText.setText(Integer.toString(score));
}

the result is then shown in textView. This is the same for activity A & B . So how can i add results for both activities and show in activity C?

Intent intent = new Intent(ActivityAB.this, ActivityC.class);
intent.putExtra("score",score);
startActivity(intent);

And to get it in ActivityC in onCreate .

Intent intent = getIntent();
int score = intent.getIntExtra("score",0);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM