English subtitles

← Whats Your Name

Get Embed Code
14 Languages

Showing Revision 3 created 05/25/2016 by Udacity Robot.

  1. We just heard some great stories from
    Googlers about how they deal with
  2. uncertainty.
  3. And now you're going to get a chance
    to deal with uncertainty too.
  4. In this next coding task,
    you're going to add a text field
  5. into the app so that someone can
    enter their name, like Larry or
  6. Kevin, into the app for
    their coffee order.
  7. At first you might not know how to
    deal with something like this, but
  8. that's okay.
  9. You can Google search for it online.
  10. And, like my mom always says,
    you can just take it one step at a time.
  11. The app should look something like
    this and here's the name field.
  12. There's a special type of view in
    Android that can handle text input.
  13. So when you tap on the field,
    then the keyboard pops up.
  14. When the field is blank,
  15. it gives you some hint text to tell
    you what you should type here.
  16. As soon as you start typing,
    then that hint text goes away.
  17. When you're done typing,
    you can just hide the keyboard.
  18. You've probably seen this view
    many times before in other apps.
  19. For example, in chat applications,
    you type your message into a field and
  20. then send it off to someone.
  21. This is actually quite a complex view,
    lots of things are happening
  22. behind the scenes, but luckily,
    Android handles all of that for us.
  23. Okay, go ahead and add this field
    to your app, then make a change so
  24. that when the user hits the order
    button, the name also appears there.
  25. First, plan out the steps
    that you need to do.
  26. You can write your answer here.
  27. As you do each step, you can
    Google search for how to do it and
  28. find example code for it,
  29. or you can look at the common
    Android views cheat sheet for ideas.
  30. You can also use logging to verify
    the value of variables along the way
  31. as you do each of these steps.
  32. When you're done,
    answer these questions on the right.
  33. What view did you end up adding?
  34. And what Java method gets you
    the text that the user entered?
  35. And lastly, what's the return
    data type of this method?
  36. Write your answer here.