Android Input method Extension of remote Input method

Source: Internet
Author: User
Tags final touch

In recent years, the Internet television began to hot, music video tv, Millet TV, the recent Archie art is also a lot of recruitment to do Archie Art television, of course, there are more attention to Apple TV. In fact, this trend is very normal, and very reasonable, the traditional simple television reception TV has been too traditional, it is the revolution. Music as a representative of the new generation of Internet television to adopt the Internet marketing way, do not need physical stores, do not need physical factory, just plan, service, online booking, Direct Express and other ways to greatly reduce the cost, but also can control inventory, prevent risk. At the same time, they insist that the hardware does not make money, service charges, more value television users of this potential value. More users, what is convenient to do, of course, there is a larger concept of smart home.

In addition to Apple TV, none of the other is using the Android system. But a variety of internet TV, in the final analysis it is still TV, unlike mobile phones, tablets, PCs and other electronic products, users from it is a distance, users can not directly touch the screen and other ways to input, so the Android soft keyboard is not good enough input interactive mode. For the English-speaking countries, this TV input is OK to solve, simply through the external keyboard input directly, but for similar to the Chinese language needs to be converted, the problem. This is because the Android external keyboard can only input English characters, while the input method is not able to get the external keyboard (only to touch the soft keyboard characters) input to convert it into Chinese. This reminds me of the title of "Remote Input Method".

A very common scene is: TV installed love kick Door remote Input method, the input method connected to the phone's remote inputs, and then the user in the remote input program using its own input method (Sogou input method), and then input the content of real-time transmission to the program in the TV.

Remote Input Method mechanism

The mechanism of remote input method is simple: do a special input method, the input method no longer by touching the soft keyboard to get input characters, but through the network directly from the other end of the network to get characters (this character can be in English, can also be Chinese, any language can be), and then the word Fu Fa to the application. The core of the input is two: Inputconnection's Committext and sendkeyevent two interfaces, the following code implementation:

private void SendText (String text) {if (!isshow ()) {LOG.D (TAG, "IME is hidden");  
    Return  
     Final Inputconnection IC = Getcurrentinputconnection ();  
         if (IC = = null) {LOG.D (TAG, "IC null");  
     Return  
 ///Send to program Ic.committext (text, Text.length ()) of any language language;  
     The public void senddownupkeyevents (int keyeventcode) {inputconnection IC = getcurrentinputconnection ();  
     if (IC = = null) return;  
     Long eventtime = Systemclock.uptimemillis (); Send Delete,backspace Delete characters and other special input, special input is through the Key to achieve Oh Ic.sendkeyevent (new KeyEvent (Eventtime, Eventtime, key Event.action_down, Keyeventcode, 0, 0, keycharactermap.virtual_keyboard, 0, keyevent.flag_soft_keyboard|  
     Keyevent.flag_keep_touch_mode));  Ic.sendkeyevent (New KeyEvent (Systemclock.uptimemillis), Eventtime, keyevent.action_up, Keyeventcode, 0, 0,  
 Keycharactermap.virtual_keyboard, 0,            keyevent.flag_soft_keyboard|  
 Keyevent.flag_keep_touch_mode)); }

Then is the big head of the Code, Network module: To achieve the LAN Search service, automatic connection, network data transmission.

Back to the column page: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/

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.