Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bundle - send and receive data
// 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