Содержание
- 2. Are you ready? Do you have Android Studio installed? Have you created and ran your first
- 3. Overview We’ll create a simple app with two activities First activity with an EditText view and
- 4. Overview This opens a second activity with “Email” button and a TextView that displays the message.
- 5. Overview Clicking on the “Email” button opens the email app which is installed on the device
- 6. Let’s Begin Solution will be available here: https://bit.ly/2x1ZNno in one week, before the next lecture. Now
- 7. Step 1 - Create a new project For help go to the lecture slides: https://goo.gl/sQpvP4
- 8. Step 2 Create the main activity layout, something like this See next slide for more info
- 9. About EditText EditText is a View that allows the user to enter text. When the user
- 10. About EditText “hint” attribute is the text that will be shown when no text was entered.
- 11. Step 2 - Now you can Create the main activity layout. Feel free to edit the
- 12. Step 3 On Preview button click: Open a new activity with a TextView which shows the
- 13. Step 3 - steps[1/3] Create a new Activity class (Empty Activity) Edit the activity’s layout as
- 14. Step 3 - steps[2/3] 3. Set OnClickListener to your button and implement the code: Create an
- 15. Step 3 - steps[3/3] 4. On the second activity: get the message from the intent’s extras
- 16. Step 4 On Email button click: Open a new email activity Pre-fill the email “To” with
- 17. Open an Email App In the lecture we used an explicit intent to open a specific
- 18. Implicit Intents Use this: https://developer.android.com/guide/components/intents-common.html To find out how to create an email implicit intent and
- 19. Toasts If there is no Email app on the user’s device, show him some message about
- 20. DONE? That’s amazing! Great job!! But we have some bonus tasks if you wanna try. If
- 21. Bonus Make sure your all of your strings and dimensions are not hardcoded in XML files,
- 22. Localization [1/2] To create other language localization: Open strings.xml On the top right : “open editor”
- 23. Localization [2/2] Fill in the translations in the editor In the left Project structure panel find
- 25. Скачать презентацию