Hi there,

I want to implement a custom input method for certain EditTexts within
my app. I understand I need to extend the InputMethodService class,
but how do I then add this to certain views? I've tried just using the
class name in the android:inputMethod XML property, but this seems not
to work.

Using the SoftKeyboard example in the 1.5 SDK, my manifest is as
follows:


--------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android";
      package="Softkeyboard.example"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/
app_name">
        <service android:name="SoftKeyboard"
 
android:permission="android.permission.BIND_INPUT_METHOD">
            <intent-filter>
                <action android:name="android.view.InputMethod" />
            </intent-filter>
            <meta-data android:name="android.view.im"
android:resource="@xml/method" />
        </service>
        <activity android:name=".SoftkeyboardEx"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
    <uses-sdk android:minSdkVersion="3" />

</manifest>
--------------------------------------

and the xml code:


--------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/hello"
    />
<EditText
        android:id="@+id/EditText01"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:inputMethod="SoftKeyboard">
</EditText>
</LinearLayout>
--------------------------------------


The app fails with a ClassNotFoundException. However removing
'android:inputMethod="SoftKeyboard"' fixes it, and I can select
SoftKeyboard as an input method for the EditText when it is running.

What am I doing wrong? Have I declared something wrongly in the
manifest?

Thanks

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

Reply via email to