Added in API level 1

Callback


interface Callback
AbstractInputMethodService

AbstractInputMethodService provides a abstract base class for input methods.

Activity

An activity is a single, focused thing that the user can do.

Dialog

Base class for Dialogs.

TvAdService.Session

Base class for derived classes to implement to provide a TV AD session.

TvInputService.Session

Base class for derived classes to implement to provide a TV input session.

TvInteractiveAppService.Session

Base class for derived classes to implement to provide a TV interactive app session.

View

This class represents the basic building block for user interface components.

VoiceInteractionSession

An active voice interaction session, providing a facility for the implementation to interact with the user in the voice interaction layer.

AbsListView

Base class that can be used to implement virtualized lists of items.

AbsSeekBar

AbsSeekBar extends the capabilities of ProgressBar by adding a draggable thumb.

AbsSpinner

An abstract base class for spinner widgets.

AbsoluteLayout

A layout that lets you specify exact locations (x/y coordinates) of its children.

AccountAuthenticatorActivity

Base class for implementing an Activity that is used to help implement an AbstractAccountAuthenticator.

ActionMenuView

ActionMenuView is a presentation of a series of menu options as a View.

ActivityGroup

A screen that contains and runs multiple embedded activities.

AdapterView

An AdapterView is a view whose children are determined by an Adapter.

AdapterViewAnimator

Base class for a AdapterView that will perform animations when switching between its views.

AdapterViewFlipper

Simple ViewAnimator that will animate between two or more views that have been added to it.

AlertDialog

A subclass of Dialog that can display one, two or three buttons.

AliasActivity

Stub activity that launches another activity (and then finishes itself) based on information in its component's manifest meta-data.

AnalogClock

This widget displays an analogic clock with two hands for hours and minutes.

AppWidgetHostView

Provides the glue to show AppWidget views.

AutoCompleteTextView

An editable text view that shows completion suggestions automatically while the user is typing.

Button

A user interface element the user can tap or click to perform an action.

CalendarView

This class is a calendar widget for displaying and selecting dates.

CharacterPickerDialog

Dialog for choosing accented characters related to a base character.

CheckBox

A checkbox is a specific type of two-states button that can be either checked or unchecked.

CheckedTextView

An extension to TextView that supports the Checkable interface and displays.

Chronometer

Class that implements a simple timer.

CompoundButton

A button with two states, checked and unchecked.

DatePicker

Provides a widget for selecting a date.

DatePickerDialog

A simple dialog containing an android.widget.DatePicker.

DialerFilter

This widget is a layout that contains several specifically-named child views that handle keyboard entry interpreted as standard phone dialpad digits.

DigitalClock

Like AnalogClock, but digital.

EditText

A user interface element for entering and modifying text.

ExpandableListActivity

An activity that displays an expandable list of items by binding to a data source implementing the ExpandableListAdapter, and exposes event handlers when the user selects an item.

ExpandableListView

A view that shows items in a vertically scrolling two-level list.

ExtractEditText

* Specialization of EditText for showing and interacting with the extracted text in a full-screen input method.

FragmentBreadCrumbs

Helper class for showing "bread crumbs" representing the fragment stack in an activity.

FrameLayout

FrameLayout is designed to block out an area on the screen to display a single item.

GLSurfaceView

An implementation of SurfaceView that uses the dedicated surface for displaying OpenGL rendering.

Gallery

A view that shows items in a center-locked, horizontally scrolling list.

GestureOverlayView

A transparent overlay for gesture input that can be placed on top of other widgets or contain other widgets.

GridLayout

A layout that places its children in a rectangular grid.

GridView

A view that shows items in two-dimensional scrolling grid.

HorizontalScrollView

Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display.

ImageButton

Displays a button with an image (instead of text) that can be pressed or clicked by the user.

ImageSwitcher

ViewSwitcher that switches between two ImageViews when a new image is set on it.

ImageView

Displays image resources, for example android.graphics.Bitmap or android.graphics.drawable.Drawable resources.

InlineContentView

This class represents a view that holds opaque content from another app that you can inline in your UI.

InputMethodService

InputMethodService provides a standard implementation of an InputMethod, which final implementations can derive from and customize.

KeyboardView

A view that renders a virtual Keyboard.

LauncherActivity

Displays a list of all activities which can be performed for a given intent.

LinearLayout

A layout that arranges other views either horizontally in a single column or vertically in a single row.

ListActivity

An activity that displays a list of items by binding to a data source such as an array or Cursor, and exposes event handlers when the user selects an item.

ListView

Displays a vertically-scrollable collection of views, where each view is positioned immediatelybelow the previous view in the list.

MediaController

A view containing controls for a MediaPlayer.

MediaRouteButton

MultiAutoCompleteTextView

An editable text view, extending AutoCompleteTextView, that can show completion suggestions for the substring of the text where the user is typing instead of necessarily for the entire thing.

NativeActivity

Convenience for implementing an activity that will be implemented purely in native code.

NumberPicker

A widget that enables the user to select a number from a predefined range.

PreferenceActivity

This is the base class for an activity to show a hierarchy of preferences to the user.

Presentation

Base class for presentations.

ProgressBar

A user interface element that indicates the progress of an operation.

ProgressDialog

A dialog showing a progress indicator and an optional text message or view.

QuickContactBadge

Widget used to show an image with the standard QuickContact badge and on-click behavior.

RadioButton

A radio button is a two-states button that can be either checked or unchecked.

RadioGroup

This class is used to create a multiple-exclusion scope for a set of radio buttons.

RatingBar

A RatingBar is an extension of SeekBar and ProgressBar that shows a rating in stars.

RelativeLayout

A Layout where the positions of the children can be described in relation to each other or to the parent.

ScrollView

A view group that allows the view hierarchy placed within it to be scrolled.

SearchView

A widget that provides a user interface for the user to enter a search query and submit a request to a search provider.

SeekBar

A SeekBar is an extension of ProgressBar that adds a draggable thumb.

SlidingDrawer

SlidingDrawer hides content out of the screen and allows the user to drag a handle to bring the content on screen.

Space

Space is a lightweight View subclass that may be used to create gaps between components in general purpose layouts.

Spinner

A view that displays one child at a time and lets the user pick among them.

SplashScreenView

The view which allows an activity to customize its splash screen exit animation.

StackView

SurfaceView

Provides a dedicated drawing surface embedded inside of a view hierarchy.

Switch

A Switch is a two-state toggle widget.

TabActivity

For apps developing against android.os.Build.VERSION_CODES#HONEYCOMB or later, tabs are typically presented in the UI using the new ActionBar.newTab() and related APIs for placing tabs within their action bar area.

TabHost

Container for a tabbed window view.

TabWidget

Displays a list of tab labels representing each page in the parent's tab collection.

TableLayout

A layout that arranges its children into rows and columns.

TableRow

A layout that arranges its children horizontally.

TextClock

TextClock can display the current date and/or time as a formatted string.

TextSwitcher

Specialized android.widget.ViewSwitcher that contains only children of type android.widget.TextView.

TextView

A user interface element that displays text to the user.

TextureView

A TextureView can be used to display a content stream, such as that coming from a camera preview, a video, or an OpenGL scene.

TimePicker

A widget for selecting the time of day, in either 24-hour or AM/PM mode.

TimePickerDialog

A dialog that prompts the user for the time of day using a TimePicker.

ToggleButton

Displays checked/unchecked states as a button with a "light" indicator and by default accompanied with the text "ON" or "OFF".

Toolbar

A standard toolbar for use within application content.

TvAdView

Displays contents of TV advertisement services.

TvInputService.HardwareSession

Base class for a TV input session which represents an external device connected to a hardware TV input.

TvInteractiveAppView

Displays contents of interactive TV applications.

TvView

Displays TV contents.

TwoLineListItem

A view group with two children, intended for use in ListViews.

VideoView

Displays a video file.

ViewAnimator

Base class for a FrameLayout container that will perform animations when switching between its views.

ViewFlipper

Simple ViewAnimator that will animate between two or more views that have been added to it.

ViewGroup

A ViewGroup is a special view that can contain other views (called children.) The view group is the base class for layouts and views containers.

ViewStub

A ViewStub is an invisible, zero-sized View that can be used to lazily inflate layout resources at runtime.

ViewSwitcher

ViewAnimator that switches between two views, and has a factory from which these views are created.

WebView

A View that displays web pages.

ZoomButton

This widget provides a simple utility for turning a continued long-press event into a series of clicks at some set frequency.

ZoomControls

The ZoomControls class displays a simple set of controls used for zooming and provides callbacks to register for events.

Summary

Public methods
abstract Boolean
onKeyDown(keyCode: Int, event: KeyEvent!)

Called when a key down event has occurred.

abstract Boolean
onKeyLongPress(keyCode: Int, event: KeyEvent!)

Called when a long press has occurred.

abstract Boolean
onKeyMultiple(keyCode: Int, count: Int, event: KeyEvent!)

Called when a user's interaction with an analog control, such as flinging a trackball, generates simulated down/up events for the same key multiple times in quick succession.

abstract Boolean
onKeyUp(keyCode: Int, event: KeyEvent!)

Called when a key up event has occurred.

Public methods

onKeyDown

Added in API level 1
abstract fun onKeyDown(
    keyCode: Int,
    event: KeyEvent!
): Boolean

Called when a key down event has occurred. If you return true, you can first call KeyEvent.startTracking() to have the framework track the event through its onKeyUp(int,android.view.KeyEvent) and also call your onKeyLongPress(int,android.view.KeyEvent) if it occurs.

Parameters
keyCode Int: The value in event.getKeyCode().
event KeyEvent!: Description of the key event.
Return
Boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

onKeyLongPress

Added in API level 5
abstract fun onKeyLongPress(
    keyCode: Int,
    event: KeyEvent!
): Boolean

Called when a long press has occurred. If you return true, the final key up will have KeyEvent.FLAG_CANCELED and KeyEvent.FLAG_CANCELED_LONG_PRESS set. Note that in order to receive this callback, someone in the event change must return true from onKeyDown and call KeyEvent.startTracking() on the event.

Parameters
keyCode Int: The value in event.getKeyCode().
event KeyEvent!: Description of the key event.
Return
Boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

onKeyMultiple

Added in API level 1
abstract fun onKeyMultiple(
    keyCode: Int,
    count: Int,
    event: KeyEvent!
): Boolean

Called when a user's interaction with an analog control, such as flinging a trackball, generates simulated down/up events for the same key multiple times in quick succession.

Parameters
keyCode Int: The value in event.getKeyCode().
count Int: Number of pairs as returned by event.getRepeatCount().
event KeyEvent!: Description of the key event.
Return
Boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

onKeyUp

Added in API level 1
abstract fun onKeyUp(
    keyCode: Int,
    event: KeyEvent!
): Boolean

Called when a key up event has occurred.

Parameters
keyCode Int: The value in event.getKeyCode().
event KeyEvent!: Description of the key event.
Return
Boolean If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.