Transferring int variable between activities Android -


I'm making a quiz game. However, I can be modified that need to add a score variable, the way the game works, it uses a few different activities. How can I broadcast this score and amend it in all the activities.

An example of an integer passing from here is an activity in some other activity.

Start Activity ACT and enter it like this:

  intends theIntent = new intent (this, activity class.); TheIntent.putExtra ("somename", intVariable); StartActivity (theIntent);   

Obtain the integer from within a circle:

  int i = getIntent (). GetIntExtra ("somename");    

Comments