How to pass data between Activities in Android?

Consider a scenario after login activity , Sign-out button visible in each activity , now we need to keep session ID available of all activities !!


The easiest way to do this would be to pass the session id to the signout activity in the Intent you’re using to
start the activity:

Intent intent = new Intent(getBaseContext(), SignoutActivity.class);
intent.putExtra("EXTRA_SESSION_ID", sessionId);

Access that intent on next activity:

String sessionId = getIntent().getStringExtra("EXTRA_SESSION_ID");