Книга: Beginning Android
Useful Methods
Useful Methods
You can toggle whether or not a widget is enabled via setEnabled()
and see if it is enabled via isEnabled()
. One common use pattern for this is to disable some widgets based on a CheckBox
or RadioButton
selection.
You can give a widget focus via requestFocus()
and see if it is focused via isFocused()
. You might use this in concert with disabling widgets as previously mentioned, to ensure the proper widget has the focus once your disabling operation is complete.
To help navigate the tree of widgets and containers that make up an activity’s overall view, you can use:
• getParent()
to find the parent widget or container
• findViewById()
to find a child widget with a certain ID
• getRootView()
to get the root of the tree (e.g., what you provided to the activity via setContentView()
)
- Methods of Attack
- 15.4 Resource Synchronization Methods
- 8.3. Driver Methods
- 14.2.3. Useful Kernel Breakpoints
- 14.3.4. Useful Kernel gdb Macros
- Appendix B. Useful Cable Configurations
- Other Useful Tools
- Some Useful Macro Definitions
- Some Useful sendmail Configurations
- Adding Additional Test Methods
- Abstract Methods
- Virtual Methods