Android interaction experience required: function button events

Source: Internet
Author: User
Tags constant definition

BKJIA exclusive translation this article is translated from the foreign language website tutsplus.com "Android interactive experience must know: function button event". All translations are as follows:

Start learning

Each Android device generally provides physical function buttons except letters and numbers, which are generally different from those of different Android manufacturers, for example, Sony only implements three of these function buttons. If these buttons are well designed, they can provide a good interactive experience for the apps being developed.

Android applications are mainly designed based on Activities. I believe most developers are familiar with this design and can learn it in the Official development manual. Today, we are going to learn how to implement the KeyEvent. Callback interface to redefine the function buttons on Android devices and serve our applications.

Constant definition and method of function buttons

The KeyEvent class has multiple defined key constants, which indicate the function buttons in a standard Android device:

Function buttons

Constant Definition

Description

Power

KEYCODE_POWER

Enable or wake up a device

Back

KEYCODE_BACK

Back to the previous page)

Home

KEYCODE_HOME

Return to the main menu screen)

SEARCH

KEYCODE_SEARCH

Open a search

CAMERA

KEYCODE_CAMERA

Enable camera function

VOLUME

KEYCODE_VOLUME_UP

KEYCODE_VOLUME_DOWN

Adjust volume

You can find

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.