Created
May 12, 2020 22:19
-
-
Save magdamiu/fd4a9024cfec6e8dd7874f4d3e11f987 to your computer and use it in GitHub Desktop.
Bundle - send and receive data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// send data | |
String message = "just a text"; | |
Intent lunchReceiveTextActivity = new Intent(BundleSampleActivity.this, ReceiveTextActivity.class); | |
lunchReceiveTextActivity.putExtra(BundleSampleActivity.TEXT, message); | |
startActivity(lunchReceiveTextActivity); | |
// get data | |
Bundle bundle = getIntent().getExtras(); | |
if(bundle != null) { | |
String message = intent.getStringExtra(SendTextActivity.CAROL); | |
if (!message.isEmpty()) { | |
// use the received message | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment