android-input-method

add custom image as Emoji in android

只愿长相守 提交于 2020-01-01 03:28:08
问题 how to add custom image as emoji in android InputMethodService. i have tried using ImageGetter imageGetter = new ImageGetter() { public Drawable getDrawable(String source) { StringTokenizer st = new StringTokenizer(str, "."); Drawable d = new BitmapDrawable(getResources(),emoticons[Integer.parseInt(st.nextToken()) - 1]); d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); return d; } }; Spanned cs = Html.fromHtml("<img src ='"+ str +"'/>", imageGetter, null);

EditText with textPassword inputType, but without Softkeyboard

早过忘川 提交于 2019-12-31 07:08:08
问题 i wanted to create an EditText with an android:inputType="textPassword. However i also do not want to use the SoftKeyboard for input. So i tried setting InputMethod to null, but this would also disable the textPassword features of replacing password rendering to " * [lastchar]". Is there any other way to disable the softKeyboard from showing up? 回答1: Uhm just figured it out myself: Simply use: pinInput.setOnClickListener(new OnClickListener() { public void onClick(View v) { InputMethodManager

how to get user keyboard language

旧时模样 提交于 2019-12-25 06:44:34
问题 I am writing an application which is using a edit text .i want to know whats users input language in oncreate method or when keyboard input type changes. Is there any way to set a listener to get that change? All the answer i found were about locale and not about input language. I don't want to handle locale, locale has no effect in application, the input language does. i used this codes. private void printInputLanguages() { List<InputMethodInfo> ims = imm.getEnabledInputMethodList(); for

how to get user keyboard language

拜拜、爱过 提交于 2019-12-25 06:42:19
问题 I am writing an application which is using a edit text .i want to know whats users input language in oncreate method or when keyboard input type changes. Is there any way to set a listener to get that change? All the answer i found were about locale and not about input language. I don't want to handle locale, locale has no effect in application, the input language does. i used this codes. private void printInputLanguages() { List<InputMethodInfo> ims = imm.getEnabledInputMethodList(); for

How to use android:inputType on an EditText to specify my custom IME?

岁酱吖の 提交于 2019-12-24 20:44:07
问题 My app includes a custom IME (that extends InputMethodService) and I would now like to specify this as the IME for all the EditTexts within my app. Specifying an android:inputMethod for each EditText seems to be one old way of doing it, but android:inputMethod is now deprecated. The tooltip says to use android:inputType instead. My existing code for one EditText is android:inputType="numberPassword" , but when I change this to android:inputType=".MyCustomIME" (or android:inputType="com

ClassNotFoundException when specifying custom IME as EditText's android:inputMethod value

别说谁变了你拦得住时间么 提交于 2019-12-24 18:33:32
问题 My app includes a custom IME, MyCustomIME . It works fine when the user manually selects it as the device's input method. However, when I try to specify MyCustomIME as the input method for an EditText within my EnterPinActivity 's layout file: <EditText android:id="@+id/pinEditText" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="numberPassword" android:inputMethod="com.example.MyCustomIME" android:maxLength="4" /> I get this exception: java.lang

Getting proper text input from physical keyboard in Android

痴心易碎 提交于 2019-12-24 10:58:32
问题 I have a View that overrides the OnKeyDown event. I can get the Key Code and the KeyEvent, but it seems that I'm missing something. Let me explain. For non-US keyboard layouts, the Key Code I'm getting is wrong. For example, when I press the ñ key in my Spanish keyboard , I expect to receive a "ñ" letter, but instead I get a Keycode.AltLeft as Key Code. How do I get the real letter? Another problematic case is with accentuated characters: When I press the ´ key and the o key, I shouldn't

Custom AOSP Keyboard Error: DictionaryProvider ClassNotFoundException

会有一股神秘感。 提交于 2019-12-24 05:13:07
问题 I'm trying to build the AOSP keyboard from the 5.0.2 branch after adding some custom code to obtain pressure values for key touches. I'm using lunch full-eng to build the source and using mm to build LatinIME after I've added my changes. I'm then pushing LatinIME to /system/apps/ on my Galaxy S3 after removing the previous version. I'm running an unofficial version of CM12 5.0.2 on the device. The error I get is below which appears to have nothing to do with my code changes but more likely in

Calling InputMethodManager.setInputMethod(IBinder token, String id) outside the InputMethodService. Where to find token?

你离开我真会死。 提交于 2019-12-22 09:45:50
问题 I want to show Google Voice Typing IME on my EditText by clicking on Button. So, according to this article and source code I should write this code inputMethodManager.setInputMethodAndSubtype(IBinder token, String id, InputMethodSubtype subtype) The problem is: where to find appropriate token. In the source code I saw this mInputMethodService.getWindow().getWindow().getAttributes().token It works great, but this code located in InputMetodService superclass, so it has access to

How do I change the input method programatically?

孤街浪徒 提交于 2019-12-21 02:47:28
问题 I have a requirement of changing the keyboard based on the change of language. I have done a bit of research and found that it can be done using these APIs InputMethodManager setInputMethod(android.os.IBinder, java.lang.String) InputMethodService switchInputMethod(java.lang.String) For the 1st API, I need an IBinder token which can be taken from InputMethodService instance by calling mInputMethodService.getWindow().getWindow().getAttributes().token or if I have the reference to