Android api (83) -- InputMethodSession [input method]

Source: Internet
Author: User

 

Preface

This chapter is about android. view. inputmethod. InputMethodSession. It is about the input method. The version is Android 2.3 r1 and translated from "liubizhi". Welcome to his blog: http://www.cnblogs.com/zcmky/. Thank you again "! I look forward to you join the Android API Chinese translation, contact me over140@gmail.com.

 

Statement

You are welcome to repost, but please keep the original source of the article :)

Blog Garden: http://www.cnblogs.com/

Android Chinese translation group: http://code.taobao.org/project/view/404/

 

Body

I. Structure

Public interface InputMethodSession

Android. view. inputmethod. InputMethodSession

Indirect subclass

AbstractInputMethodService. AbstractInputMethodSessionImpl, InputMethodService. InputMethodSessionImpl

 

Ii. Overview

The InputMethodSession interface is provided to each clientInputMethodIt can be safely exposed to applications.

Applications do not use this interface on their own, but rely onTextViewAndEditTextStandard interaction.

 

Iii. Internal class

Interface InputMethodSession. EventCallback

 

Iv. Public Methods

Public abstract voidAppPrivateCommand(String action, Bundle data)

Run the private Command sent by the application to the input method. It can be used to provide the exclusive domain function. It only applies to specific input methods and their clients.

Parameters

Name of the action execution name. It must be a domain name, such as a prefix of your own package name, so that different developers do not generate command conflicts.

Any data included with the command.

 

Public abstract voidDispatchKeyEvent(Int seq, KeyEvent event, InputMethodSession. EventCallback callback)

This method is called when you press the key. When an event is completed, the implementation method of this method must be called.CallbackCallback Function and return results.

If the input method processes this event, true is returned. Otherwise, false is returned. The caller (such as an application) processes the event.

Parameters

Event button event

Return Value

Whether the input method processes this event.

See

ERROR(/#dispatchKeyUp)

KeyEvent

 

Public abstract voidDispatchTrackballEvent(Int seq, MotionEvent event, InputMethodSession. EventCallback callback)

This method is called when a trackball event occurs.

If the input method processes this event, true is returned. Otherwise, false is returned. The caller (such as an application) processes the event.

Parameters

Event mobile event

Return Value

Whether the input method processes this event.

See

MotionEvent

 

Public abstract voidDisplayCompletions(CompletionInfo [] completions)

The text editor calls auto-completion, and the notification Input Method completion is valid after completion. It can be used for input methods to display alternative text to users for insertion.

Parameters

The completions supplemental text array is valid and starts with the best result. If the array is empty, the Supplement will be removed.

 

Public abstract voidFinishInput()

This method is called when the application stops receiving text input.

 

Public abstract voidToggleSoftInput(Int showFlags, int hideFlags)

Switch the soft input window. The application can switch the soft input window.

Parameters

ShowFlags provides additional operation flags. It may be 0 or set the SHOW_IMPLICIT and SHOW_FORCED bits.

HideFlags provides additional operation flags. It may be 0 or HIDE_IMPLICIT_ONLY, HIDE_NOT_ALWAYS.

 

Public abstract voidUpdateCursor(Rect newCursor)

This method is called when the cursor position of the target input field moves in its own window. This method is usually not called, but can be called when the input method is required to be updated.

Parameters

The matrix area displayed by the cursor in the window Coordinate System of the current input area of newCursor.

 

Public abstract voidUpdateExtractedText(Int token, ExtractedText text)

When the content changes, the text editor calls this method to notify the new user of text extraction. This method is called only in the input method.InputConnection.getExtractedText()It is called only when it comes with the update notification option.

Parameters

The token input method provides the token required for resolution.

New text extraction.

 

Public abstract voidUpdateSelection(Int oldSelStart, int oldSelEnd, int newSelStart, int newSelEnd, int candidatesStart, int candidatesEnd)

This method is called when the cursor of the target input field or the selected changes.

Parameters

The selected Start position prior to oldSelStart is offset from the text of the cursor.

The selected end position prior to oldSelEnd is offset from the text of the cursor.

NewSelStart: The text offset between the selected initial position and the cursor.

NewSelEnd: The text offset between the selected end position and the cursor.

CandidatesStart text offset of the start position of text in the current coordinate system.

The text offset of the end position of the text in the current coordinate system.

 

5. Supplement

Article Link

Android intellij idea's notebook tracking, visualization, hidden data and bugs

 

Related Article

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.