how to pass data between activities in android code example

Example 1: send variable intent

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

Example 2: send variable intent

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

Example 3: how to pass string between activities android

Bundle extras = getIntent().getExtras();
if(extras !=null) {
    String value = extras.getString("KEY");
}

Example 4: how to pass string between activities android

Intent i = new Intent(this, FindAndroidActivity.class);
i.putExtra("KEY",YourData);

Tags:

Java Example