Оцените презентацию от 1 до 5 баллов!
Тип файла:
ppt / pptx (powerpoint)
Всего слайдов:
24 слайда
Для класса:
1,2,3,4,5,6,7,8,9,10,11
Размер файла:
3.51 MB
Просмотров:
64
Скачиваний:
0
Автор:
неизвестен
Слайды и текст к этой презентации:
№1 слайд![Exercise session . . Sergey](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img0.jpg)
Содержание слайда: Exercise session 1
11.09.2018
Sergey Ryabov
№2 слайд![Are you ready? Do you have](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img1.jpg)
Содержание слайда: Are you ready?
Do you have Android Studio installed?
Have you created and ran your first project?
If not yet, please, do exercise 0 first to set up your environment
Install Android Studio and have “Hello world” running on your phone:
http://bit.ly/2LZVRZ4
№3 слайд![Overview We ll create a](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img2.jpg)
Содержание слайда: Overview
We’ll create a simple app with two activities
First activity with an EditText view and a “Preview” button
The user enters a message into the EditText and hits “Preview”
№4 слайд![Overview This opens a second](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img3.jpg)
Содержание слайда: Overview
This opens a second activity with “Email” button and
a TextView that displays the message.
You can check the text and if it’s good enough, you can send it via email app by clicking “Email” button
№5 слайд![Overview Clicking on the](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img4.jpg)
Содержание слайда: Overview
Clicking on the “Email” button
opens the email app which is installed on the device
(e.g. gmail)
with the message as a new email’s content.
№6 слайд![Let s Begin Solution will be](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img5.jpg)
Содержание слайда: Let’s Begin
Solution will be available here: https://bit.ly/2x1ZNno in one week,
before the next lecture.
Now it’s time for you to make progress!!
№7 слайд![Step - Create a new project](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img6.jpg)
Содержание слайда: Step 1 - Create a new project
For help go to the lecture slides: https://goo.gl/sQpvP4
№8 слайд![Step Create the main activity](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img7.jpg)
Содержание слайда: Step 2
Create the main activity layout, something like this
See next slide for more info
№9 слайд![About EditText EditText is a](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img8.jpg)
Содержание слайда: About EditText
EditText is a View that allows the user to enter text.
When the user clicks on it, the keyboard opens.
Using view attribute “inputType”, you can indicate which keyboard should pop up (only numbers, all caps, email etc…)
Documentation: https://developer.android.com/reference/android/widget/EditText.html
№10 слайд![About EditText hint attribute](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img9.jpg)
Содержание слайда: About EditText
“hint” attribute is the text that will be shown when no text was entered.
To get the entered text dynamically at runtime use editText.getText().toString().
№11 слайд![Step - Now you can Create the](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img10.jpg)
Содержание слайда: Step 2 - Now you can
Create the main activity layout.
Feel free to edit the design
with what we learned in class
(don’t waste too much time on it, we have more stuff to do :) )
№12 слайд![Step On Preview button click](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img11.jpg)
Содержание слайда: Step 3
On Preview button click:
Open a new activity with a TextView which shows the message you typed in on the previous activity.
[want more guidance? See steps 1-3 on next slides]
№13 слайд![Step - steps Create a new](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img12.jpg)
Содержание слайда: Step 3 - steps[1/3]
Create a new Activity class (Empty Activity)
Edit the activity’s layout as needed
№14 слайд![Step - steps .Set](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img13.jpg)
Содержание слайда: Step 3 - steps[2/3]
3. Set OnClickListener to your button and implement the code:
Create an intent that starts the new activity and passes the text from the EditText through the intent’s extras, like in the lecture slides.
№15 слайд![Step - steps .On the second](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img14.jpg)
Содержание слайда: Step 3 - steps[3/3]
4. On the second activity: get the message from the intent’s extras
5. On the second activity: show the message in the activity’s TextView
№16 слайд![Step On Email button click](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img15.jpg)
Содержание слайда: Step 4
On Email button click:
Open a new email activity
Pre-fill the email “To” with your email address
Pre-fill the email “Subject” with some predefined text
Pre-fill the email “Body” with your message
See next slide for more info
№17 слайд![Open an Email App In the](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img16.jpg)
Содержание слайда: Open an Email App
In the lecture we used an explicit intent to open a specific activity which we created and knew about.
What happens when we want to start just any activity that can perform our task? I.e. any activity that can send an email or take a photo or dial a number or navigate.
We can use an implicit intent. We just tell what we want to do and Android will suggest the apps those can provide that functionality.
№18 слайд![Implicit Intents Use this](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img17.jpg)
Содержание слайда: Implicit Intents
Use this:
https://developer.android.com/guide/components/intents-common.html
To find out how to create an email implicit intent and which keys to add to the intent bundle.
Hint: Look for SEND_TO action
WARNING: pay attention to this caution notice
№19 слайд![Toasts http](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img18.jpg)
Содержание слайда: Toasts
http://developer.android.com/guide/topics/ui/notifiers/toasts.html
№20 слайд![DONE? That s amazing! Great](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img19.jpg)
Содержание слайда: DONE?
That’s amazing! Great job!!
But we have some bonus tasks if you wanna try.
If you have even a small question - don’t forget to ask the mentors
in class or on Slack.
№21 слайд![Bonus Make sure your all of](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img20.jpg)
Содержание слайда: Bonus
Make sure your all of your strings and dimensions are not hardcoded in XML files, but rather are extracted to the corresponding resource XML files (strings.xml, dimens.xml)
Create a different layout for landscape as we saw in the lecture.
Make your app Russian (or other language) compatible. See next slide for details.
№22 слайд![Localization To create other](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img21.jpg)
Содержание слайда: Localization [1/2]
To create other language localization:
Open strings.xml
On the top right : “open editor”
On the top left: click the globe icon and select the language you want.
№23 слайд![Localization Fill in the](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img22.jpg)
Содержание слайда: Localization [2/2]
Fill in the translations in the editor
In the left Project structure panel find the new strings.xml that was created with the new locale. Click on it to explore the xml.
Change your device’s language settings (if not in
Russian yet)
Run and check your Russianized app!
Check out real folder structure of your project to understand the concept
№24 слайд![Awesome! You re all done with](/documents_6/53308227f5c9b647ae9df0a7be800e9f/img23.jpg)
Содержание слайда: Awesome!
You’re all done with exercise 1!
See you next time!