Lesson Plan: Unit - 03
Subject: P15A2AAD - Android Application Development
Topic of Study: Retrieving Data From Users
Grade/Level: Master of Computer Applications
Objective: To understand Retrieving Data From Users using Edit Text control and its properties
Time Allotment: 55 Minutes
- Retrieving Data from users
- Two frequently used controls to handle this type of job are EditText controls and Spinner controls.
- Exa.
- The Android SDK provides a convenient control called EditText to handle text input from a user.
- The EditText class is derived from TextView.
- Exa.
- By default, the user can perform a long press to bring up a context menu.
- This provides to the user some basic copy, cut, and paste operations as well as the ability to change the input method and add a word to the user’s dictionary of frequently used words.
- You do not need to provide any additional code for this useful behavior to benefit your users.
- You can also highlight a portion of the text from code, too.
- Exa.
- The EditText object is essentially an editable TextView.
- This means that you can read text from it in the same way as you did with TextView: by using the getText() method.
- You can also set initial text to draw in the text entry area using the setText() method.
- This is useful when a user edits a form that already has data.
- Finally, you can set the editable attribute to false, so the user cannot edit the text in the field but can still copy text out of it using a long press.
- Exa of Input type attributes of EditText.