Android.view.inputmethod

Source: Internet
Author: User

Interface
    • Inputconnection
    • Inputmethod
    • Inputmethod.sessioncallback
    • Inputmethodsession
    • Inputmethodsession.eventcallback
Class
    • Baseinputconnection
    • Completioninfo
    • Editorinfo
    • Extractedtext
    • Extractedtextrequest
    • InputBinding
    • Inputconnectionwrapper
    • Inputmethodinfo
    • Inputmethodmanager
Inputmethod

Structure Inheritance Relationship
Public interface Inputmethod extends Objectandroid.view.inputmethod.InputMethod
Indirect sub-class
    • Abstractinputmethodservice.abstractinputmethodimpl,
    • Inputmethodservice.inputmethodimpl


class overview The Inputmethod interface represents an input method that generates key events and generates text such as numbers, email addresses, CJK characters, other language characters, and so on. Returns text to an application that requires text input when processing an input event.InputmethodmanagerYou can get more information about the architecture.
Applications typically do not use the interface itself, but rely on the standard interactions provided by TextView and EditText.
Input method implementations are typicallyInputmethodserviceAnd the derivation of its subclasses. When you implement an input method, the service control that contains it must provideService_meta_dataMetadata field that joins to an XML resource that contains the input method details. All input methods must also require the client to includeBind_input_methodTo interact with the service control. If this is not the case, the input method cannot be used because it cannot confirm the integrity of the system.
The Inputmethod interface is actually divided into two parts:
    1. Interface is the most advanced interface of the input method, providing all access, only the system can access (requires Bind_input_method permissions).
    2. Alternatively, call Method CreateSession (Android.view.inputmethod.InputMethod.SessionCallback) to instantiate the Inputmethodsession sub-interface for communication with the client.


Inner class Interface Inputmethod.sessioncallback

Constant public static final String Service_interface interface name, the service that implements the input method should indicate that it supports input method, that is, it will be used for the intent filter (Intent Filter) service also need bind_input_ METHOD permission so that the application does not misuse it.
Constant value: "Android.view.InputMethod"
public static final String Service_meta_data IME publishes its own information through this name. This metadata must reference an XML resource that contains the < input-method> tag.
Constant value: "Android.view.im"
public static final int show_explicit is used as a flag for showsoftinput (int, resultreceiver): it indicates that the user explicitly requires it (a soft keyboard) to be displayed. If not set, the system decision may be a good idea to display the input method navigation actions on the user interface.

Constant value: 1 (0x00000001)
public static final int show_forced flag is used for showsoftinput (int, resultreceiver): Indicates that the user forced it (soft keyboard) to display. As set, the IME remains visible until the user cancels on the UI.

Constant value: 2 (0x00000002)



Common method public abstract void Attachtoken (IBinder token) is first called after it is created, providing a unique token to the system service session. It requires a service-aware input method to verify its operation. The token cannot be passed to the application because it obtains special permissions that the application should not get.

Note: To avoid malicious client harm, you should only receive the first token. It may come from the client later.
The public abstract void Bindinput (inputbinding binding) binds the input method to the new application environment to start and stop input processing at a later time. This method is typically called when the application first enables the IME.

Parameter binding the application window information that is bound to the input method.
public abstract void CreateSession (Inputmethod.sessioncallback callback) creates a new inputmethodsession that handles the interaction of the client application with the input method. You can then destroy the session with Revokesession (inputmethodsession) so that no client will use it.

The callback parameter is the interface that is called by the new creation session.
public abstract void Hidesoftinput (int flags, Resultreceiver resultreceiver) hides the input method's soft keyboard (soft input) part from the user.

Parameters
    • Flags displays additional information that is required. Currently always 0.
    • Resultreceiver alerts the results to clients that are required to be displayed. The result may be
      • Inputmethodmanager.result_unchanged_shown,
      • Inputmethodmanager.result_unchanged_hidden,
      • Inputmethodmanager.result_shown,
      • Inputmethodmanager.result_hidden

public abstract void Restartinput (Inputconnection inputconnection, editorinfo attribute) is called when the input method needs to be reset. This method is typically called when the input focus moves from one text box to another.

Parameters
    • Inputconnection Optional, determines the input communication channel that communicates with the text box; if it is empty, you use an input communication channel that is normally bound.
    • Attribute text box (usually EditText) the property that needs to be entered

public abstract void Revokesession (Inputmethodsession session) is closed and destroyed previously by CreateSession ( Android.view.inputmethod.InputMethod.SessionCallback) The session created. After the call, the session is no longer valid and the call to it fails.

Parameter session the inputmethodsession previously provided by Sessioncallback.sessioncreated () will be revoked.
public abstract void Setsessionenabled (Inputmethodsession session, Boolean enabled). Controls whether a particular input method session is active.

Parameters
    • The session previously provided by Sessioncallback.sessioncreated () Inputmethodsession will change.

public abstract void Showsoftinput (int flags, resultreceiver resultreceiver) Displays the input method's soft keyboard (soft input) section to the user.

Parameters
    • Flags provides additional information to display the requirements. Current is 0 or set show_explicit bit.
    • Resultreceiver alerts the results to clients that are required to be displayed. The result may be
      • Inputmethodmanager.result_unchanged_shown,
      • Inputmethodmanager.result_unchanged_hidden
      • Inputmethodmanager.result_shown
      • Inputmethodmanager.result_hidden

public abstract void Startinput (Inputconnection inputconnection, Editorinfo info) application begins to receive text, The IME is ready to call this method when the application handles receiving events and returns text.

Parameters
    • Inputconnection Optional, determines the input communication channel that communicates with the text box; if it is empty, you use an input communication channel that is normally bound.
    • Info requires the input text box (usually EditText) information.

public abstract void Unbindinput () is unbound from the application and is called when the information previously set by Bindinput (inputbinding) is not valid for the current input method. Typically, the application becomes a non-foreground call.

Android.view.inputmethod

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.