Android UI Components and Notifications

Test your knowledge of Android UI elements including Toast, DialogFragment, click handling, touch events, menus, and notifications

14 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

How to set the duration of the Toast by using Toast class?

  1. int Toast.dur=10;
  2. int dur=Toast(10);
  3. int dur=Toast.LENGTH_SHORT;
  4. int dur=Toast.LENGTH_SHORT(10);
Question 2 Multiple Choice (Single Answer)

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)

  1. Delay
  2. Toasts
  3. Toast
  4. Message Toast
Question 3 Multiple Choice (Single Answer)

To create a dialog, extend the _____________ class and implement either onCreateView or onCreateDialog method.

  1. Dialog
  2. DialogFormat
  3. DialogFragment
  4. DialogFrame
Question 4 Multiple Choice (Single Answer)

How can avoid to creating anonymous classes for click handling?

  1. Implement the click interfaces in your activity and pass in this when registering a click listener.
  2. Extends the click interfaces in your activity and pass in this when registering a click listener.
  3. Implement the click listner interfaces in your activity and pass in this when registering a click listener.
  4. Implement the click interfaces in anywhere and pass in this when registering a click listener.
Question 5 Multiple Choice (Single Answer)

A long press is triggered when the user taps and holds on the screen. Long Presses are handled by registering an ___________________.

  1. onLongPress
  2. onPressListner
  3. onLongPressListener
  4. onLongClick
Question 6 Multiple Choice (Single Answer)

_____________ introduced the Notification. Builder class for creating notification.

  1. Android 2.0
  2. Android 3.0
  3. Android 4.0
  4. Android 4.2
Question 7 Multiple Choice (Single Answer)

Which of the following method is called when the user taps the screen?

  1. onTouched
  2. onTapped
  3. onTap
  4. onTouch
Question 8 Multiple Choice (Single Answer)

The process of converting a layout XML file into a hierarchy of views is called ________.

  1. Flating
  2. Inflating
  3. Tree
  4. Ladder
Question 9 Multiple Choice (Single Answer)

Like all other Android layouts, menus can be defined using ______.

  1. XML only
  2. Java Only
  3. XML or Java
  4. .Net
Question 10 Multiple Choice (Single Answer)

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?

  1. Notification notn=new Notification(icon,ticker,cur)
  2. Notification notn=new Notification(cur,ticker,icon)
  3. Notification notn=new Notification(icon,cur,ticker)
  4. Notification notn=new Notification(ticker,icon,cur)
Question 11 Multiple Choice (Single Answer)

The onCreateOptionsMenu callback is called when the user ____________________.

  1. Click the screen
  2. Touch the menu
  3. Swap the screen
  4. Presses the menu button
Question 12 Multiple Choice (Single Answer)

When context menus triggered?

  1. By pressing button
  2. By pressing main menu
  3. By pressing a view
  4. By long-presses a view
Question 13 Multiple Choice (Single Answer)

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.

  1. Both A and B
  2. Only A
  3. Only B
  4. Neither A nor B