in JQuery by
Q:

 How do I pass data between Activities in Android application?

▼ Show 1 Answer

0 votes
by

Details

I have a scenario where, after logging in through a login page, there will be a sign-out button on each activity. Can you guide me on how to keep session id available to all activities?

Solution

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);
startActivity(intent);

Access that intent on next activity:

String sessionId = getIntent().getStringExtra("EXTRA_SESSION_ID");
Learn More with Madanswer

Related questions

0 votes
asked Jun 23, 2020 in JQuery by AdilsonLima
...