Android UI Components and Notifications
Test your knowledge of Android UI elements including Toast, DialogFragment, click handling, touch events, menus, and notifications
Questions
How to set the duration of the Toast by using Toast class?
- int Toast.dur=10;
- int dur=Toast(10);
- int dur=Toast.LENGTH_SHORT;
- int dur=Toast.LENGTH_SHORT(10);
Which of the following class is used to give a simple message that is flashed on the screen for a short time (5 to 10 seconds)
- Delay
- Toasts
- Toast
- Message Toast
To create a dialog, extend the _____________ class and implement either onCreateView or onCreateDialog method.
- Dialog
- DialogFormat
- DialogFragment
- DialogFrame
How can avoid to creating anonymous classes for click handling?
- Implement the click interfaces in your activity and pass in this when registering a click listener.
- Extends the click interfaces in your activity and pass in this when registering a click listener.
- Implement the click listner interfaces in your activity and pass in this when registering a click listener.
- Implement the click interfaces in anywhere and pass in this when registering a click listener.
A long press is triggered when the user taps and holds on the screen. Long Presses are handled by registering an ___________________.
- onLongPress
- onPressListner
- onLongPressListener
- onLongClick
_____________ introduced the Notification. Builder class for creating notification.
- Android 2.0
- Android 3.0
- Android 4.0
- Android 4.2
Which of the following method is called when the user taps the screen?
- onTouched
- onTapped
- onTap
- onTouch
The process of converting a layout XML file into a hierarchy of views is called ________.
- Flating
- Inflating
- Tree
- Ladder
Like all other Android layouts, menus can be defined using ______.
- XML only
- Java Only
- XML or Java
- .Net
int icon=R.drawable.icon;
CharSequence ticker = “Hello World”;
Long cur=System.currentTimeMillis();
What are the correct sequence to send the above values to constructor of Notification?
- Notification notn=new Notification(icon,ticker,cur)
- Notification notn=new Notification(cur,ticker,icon)
- Notification notn=new Notification(icon,cur,ticker)
- Notification notn=new Notification(ticker,icon,cur)
The onCreateOptionsMenu callback is called when the user ____________________.
- Click the screen
- Touch the menu
- Swap the screen
- Presses the menu button
When context menus triggered?
- By pressing button
- By pressing main menu
- By pressing a view
- By long-presses a view
Which of the following Statements are correct:
A. Use onCreateView to set the view hierarchy for the dialog.
B. Use onCreateDialog to create a completely custom dialog.
- Both A and B
- Only A
- Only B
- Neither A nor B