You are on page 1of 3

LEARNING TASK 8

Legaspi, Mark Anthony BSIT-3A


Reminder. Read Module 8: Android UI Controls first, before answering this section.

Instruction: Answer the following questions briefly, your


answer will be evaluated using the following rubric.

Holistic Rubric
Exceeding Meeting Approaching Below None
(10) (8) (6) (2) (0)
Substantial,
Content Clarity
specific, and/or
The presence of ideas Sufficient
illustrative
developed through developed Limited content Superficial
content No content
facts, examples, content with with inadequate and/or
demonstrating or answer
illustrations, details, adequate elaboration or minimal
strong provided.
opinions, statistics, elaboration or explanation content
development and
reasons, and/or explanation.
sophisticated
explanations.
ideas.

1. Aside from the discussed common UI controls, what other controls do you
think should a new developer need to familiarize? Why?

I think the other controls that a new developer should know are the SeekBar,
VideoView, Switch, ZoomControls, SearchView and RatingBar. The Seekbar is
an extended Progress bar. A seekbar comes with a pointer that is draggable
throughout the bar either in left or right. This helps the user to choose a
particular range of values.  The VideoView is used to display a video file. The
switch is a two-state UI element that holds either ON or OFF state. By
default, a switch is in the OFF state. A user can change its state many times.
The Zoom Controls class display simple set of controls that is used for
zooming and provides callback to register for events. Zoom Controls has two
buttons ZoomIn and ZoomOut which are used to control the zooming
functionality. The SearchView widget provide search user interface where
users can enter a search query and then submit a request to search provider.
And the RatingBar is an extended version of a seekbar. It is used to give the
rating by touching it. In the rating bar, a user can rate at a scale of 5 with a
difference of 0.5.
The other controls in android are the control external devices. The Quick
Access Device Controls feature allows the user to quickly view and control
external devices such as lights, thermostats, and cameras from the Android
power menu. The developer needs to familiarize themselves in this control
so that they can help the user to access the control external devices in easier
way and the user don’t need to find those devices because they can see it
immediately.
Those are some of the controls that a developer needs to know so that they
can provide a good user experience to the user and they can design a UI in a
more interactive way.

2. Give two important events that can implement in a Spinner. How can we
register these events?

The Spinners provide a quick way to select one value from a set. In the
default state, a spinner shows its currently selected value. Touching the
spinner displays a dropdown menu with all other available values, from
which the user can select a new one.
The first event that can implement in a Spinner is the onItemSelected. The
onItemSelected is triggered when the user selects an item from the drop-
down. The spinner object receives an on-item-selected event. The second
event is the onNothingSelected. The onNothingSelected is triggered when
the Spinner has no items or the user deselects all items. The selection can
disappear for instance when touch is activated or when the adapter becomes
empty.

To register these two events, we need to define the selection event handler
for a spinner, we need to implement the
AdapterView.OnItemSelectedListener interface and the corresponding
onItemSelected() callback method. Below is the example implementation:

public class SpinnerActivity extends Activity implements


OnItemSelectedListener {
    ...

    public void onItemSelected(AdapterView<?> parent, View view,


            int pos, long id) {
        // An item was selected. You can retrieve the selected item using
        // parent.getItemAtPosition(pos)
  }

    public void onNothingSelected(AdapterView<?> parent) {


        // Another interface callback
  }
}
The AdapterView.OnItemSelectedListener requires the onItemSelected() and
onNothingSelected() callback methods. Then we need to specify the interface
implementation by calling setOnItemSelectedListener():

Spinner spinner = (Spinner) findViewById(R.id.spinner);


spinner.setOnItemSelectedListener(this);

If we implement the AdapterView.OnItemSelectedListener interface in our


Activity or Fragment (such as in the example above), we can pass this as the
interface instance.

Score Sheet
Question 1 Question 2 Question 3 Total Score

You might also like