I did have another thought about this, which I think is a dead end:

Would it be possible to have the app change the IME on the fly as the
control gains focus?  I noticed InputMethodManager:setInputMethod(),
but I haven't seen any examples of its use.  And then I saw a post by
Dianne Hackborn saying that it's specifically not allowed to
programmatically change the IME - which makes a lot of sense from a
security perspective.

I'm just shocked that there's no way to essentially bundle an IME with
a custom control.  I must be missing something, right?  It seems like
I'm left to create the IME from scratch using AlertDialog.Builder, so
some similar construct.

On Feb 27, 4:29 pm, Todd Sjolander <[email protected]> wrote:
> Hi,
> I'm looking to have a custom component (an extended EditText) that
> uses its own input method.  I've created the input method and the
> custom component without issues, but I'm having trouble getting the
> component to use the input method.  I can use the input method with
> the component if I use it as the default IME for the system...but I
> only want to use it for this component type, not everything in the
> system, or even everything in the app.
>
> In particular, if I specify the android:inputMethod in the XML when
> laying out the component, it can't find the class when it loads the
> component:
>
> <com.test.z800h.display.control.ValidatedNumber
>         ...
>         android:inputMethod="com.test.z800h/.Z800HInput"
>         ...
> />
>
> leads to:
>
> 08-01 19:55:45.620: E/AndroidRuntime(5059): Caused by:
> java.lang.ClassNotFoundException: com.test.z800h/.Z800HInput
>
> I've also tried "com.test.z800h.input.Z800HInput" and "com.test.z800h/
> input.Z800HInput".  The fully qualified class name is
> com.test.z800h.input.Z800HInput.
>
> This is strange, because this code works:
>
> Class<?> c;
>
>         try {
>             c = Class.forName("com.test.z800h.input.Z800HInput");
>         } catch (ClassNotFoundException ex) {
>             throw new RuntimeException(ex);
>         }
>
> Maybe TextView uses a different class loader that doesn't index the
> app's package.
>
> Of course, I know android:inputMethod is deprecated.  From what I can
> tell, there really isn't another way to specify an exact input method
> for a control.  I'd be happy to do it in a non-deprecated way if there
> is one.
>
> Thanks,
> ToddSjolander

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to