Wednesday, September 15, 2010

[android-developers] how do I load an image for a softkeyboard

Hi,

I am trying to develop a softkeyboard, which uses and image, senses
the onTouch events, and sends characters to the input stream.

So I have created the essentials of the keyboard and I want to load an
image. Here's what I do:


public class mekb extends InputMethodService implements
View.OnTouchListener {

@Override public void onCreate() {
super.onCreate();
}

@Override public View onCreateInputView() {
return (KeyboardView)
getLayoutInflater().inflate(R.layout.main, null);
}
}

And this is what I have in my layout/main.xml (essentially an image
view on the bottom of the screen)

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/widget79"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<ImageView
android:id="@+id/widget93"
android:layout_width="wrap_content"
android:layout_height="200px"
android:src="@drawable/english_uppercase"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
>
</ImageView>
</RelativeLayout>

This loads and let me select the softkeyboard, but errors and stops
when I invoke the keyboard.

Is this how to load an image and return it in onCreateInputView()?

@Override public View onCreateInputView() {
return (KeyboardView)
getLayoutInflater().inflate(R.layout.main, null);
}


Any help, hint or pointer is much appreciated.

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment