Created
April 2, 2019 20:53
-
-
Save MohammadSamandari/2fa271688d7dc42f92f2d4863df01e40 to your computer and use it in GitHub Desktop.
intent - Multiple Activity - Moving from activity to another one
This file contains hidden or 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
| // Defining the second activity for moving to. | |
| Intent intent = new Intent(getApplicationContext(), SecondActivity.class); | |
| // putting and extra into an intent so that on the other activity could be recieved. | |
| intent.putExtra("editText", editText.getText().toString()); | |
| // Starting the second activity | |
| startActivity(intent); | |
| // On the Second Activity: how te recieve the intent that opened this activity. | |
| Intent intent=getIntent(); | |
| // How to extract the extra that has been put in the intent before starting the activity. | |
| intent.getStringExtra("editText"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment