Flashcards
Pass variable to a different activity
Cards in this deck (1)
- 1Write the code to pass a username from one activity to another & display it in a toast.// sender
Intent intent = new Intent(this, OtherActivity.class);
intent.putExtra("username", "Bob");
startActivity(intent);
// receiver
String username = getIntent().getExtraString("username");
Toast.makeText(this, username, Toast.LENGTH_SHORT).show()
Information
- Description
- User has deleted their subject information Flashcards on Pass variable to a different activity, created by Deleted user on 13/11/2016.
- Created by
- Deleted user · Nov 2016
- Updated
- Nov 14, 2016
- Views
- 53
- History
-
- Created by Jason Manns · Nov 11, 2016
- Copied by Jason Manns · Nov 13, 2016
- Rating