Skip to content

Most visited

Recently visited

navigation

QwertyKeyListener

public class QwertyKeyListener
extends BaseKeyListener

java.lang.Object
   ↳ android.text.method.MetaKeyKeyListener
     ↳ android.text.method.BaseKeyListener
       ↳ android.text.method.QwertyKeyListener


This is the standard key listener for alphabetic input on qwerty keyboards. You should generally not need to instantiate this yourself; TextKeyListener will do it for you.

As for all implementations of KeyListener, this class is only concerned with hardware keyboards. Software input methods have no obligation to trigger the methods in this class.

Summary

Inherited constants

From class android.text.method.MetaKeyKeyListener

Public constructors

QwertyKeyListener(TextKeyListener.Capitalize cap, boolean autoText)

Public methods

int getInputType()
static QwertyKeyListener getInstance(boolean autoText, TextKeyListener.Capitalize cap)

Returns a new or existing instance with the specified capitalization and correction properties.

static QwertyKeyListener getInstanceForFullKeyboard()

Gets an instance of the listener suitable for use with full keyboards.

static void markAsReplaced(Spannable content, int start, int end, String original)

Marks the specified region of content as having contained original prior to AutoText replacement.

boolean onKeyDown(View view, Editable content, int keyCode, KeyEvent event)

Handles presses of the meta keys.

Inherited methods

From class android.text.method.BaseKeyListener
From class android.text.method.MetaKeyKeyListener
From class java.lang.Object
From interface android.text.method.KeyListener

Public constructors

QwertyKeyListener

added in API level 1
QwertyKeyListener (TextKeyListener.Capitalize cap, 
                boolean autoText)

Parameters
cap TextKeyListener.Capitalize

autoText boolean

Public methods

getInputType

added in API level 3
int getInputType ()

Returns
int

getInstance

added in API level 1
QwertyKeyListener getInstance (boolean autoText, 
                TextKeyListener.Capitalize cap)

Returns a new or existing instance with the specified capitalization and correction properties.

Parameters
autoText boolean

cap TextKeyListener.Capitalize

Returns
QwertyKeyListener

getInstanceForFullKeyboard

added in API level 11
QwertyKeyListener getInstanceForFullKeyboard ()

Gets an instance of the listener suitable for use with full keyboards. Disables auto-capitalization, auto-text and long-press initiated on-screen character pickers.

Returns
QwertyKeyListener

markAsReplaced

added in API level 1
void markAsReplaced (Spannable content, 
                int start, 
                int end, 
                String original)

Marks the specified region of content as having contained original prior to AutoText replacement. Call this method when you have done or are about to do an AutoText-style replacement on a region of text and want to let the same mechanism (the user pressing DEL immediately after the change) undo the replacement.

Parameters
content Spannable: the Editable text where the replacement was made

start int: the start of the replaced region

end int: the end of the replaced region; the location of the cursor

original String: the text to be restored if the user presses DEL

onKeyDown

added in API level 1
boolean onKeyDown (View view, 
                Editable content, 
                int keyCode, 
                KeyEvent event)

Handles presses of the meta keys.

Parameters
view View

content Editable

keyCode int

event KeyEvent

Returns
boolean

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)