Join Chiu-Ki Chan for an in-depth discussion in this video How intents are used, part of Advanced Android Espresso Testing.
- [Instructor] Let's take a look…at how the Cat Names app uses intents.…Press Command + Shift + O to open activity_main.xml.…Click on Text to see the XML.…Close the preview and scroll down.…You can see that we have an EditText on line 10…and then buttons on line 21,…33,…and 45.…
Each of these Button have android:onClick specified.…Look at line 51.…It says goToIdeaActivity.…Scroll back up and you can see…that the other two buttons also have onClick specified…on line 39…and 27.…Come and click on one of them.…This brings us back to MainActivity…where the function is defined.…
When any of these three buttons is clicked,…this function is called.…Inside the function, we take the View that is being clicked…and cast it to a Button on line 22.…Then we create an intent to go to IdeasActivity…as specified on line 24.…In that intent, we take the text displayed on the button…and store it as an extra with the KEY_THEME…on line 25.…
Afterwards, we startActivityForResult…using this intent.…This brings us to IdeasActivity.…Come and click on IdeasActivity on line 24…
- Incoming and outgoing intents
- How intents are used
- Dependency injection
- Why extract dependencies?
- Mockito and Dagger
Skill Level Advanced
Effective Android Testing for Mobile Developerswith Chiu-Ki Chan2h 56m Intermediate
Android App Development: Data Persistence Librarieswith Annyce Davis4h 52m Intermediate
2. Hermetic Test Environment
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.