Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6724555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:42:14+00:00 2026-05-26T09:42:14+00:00

I am creating my own IME for device. What I need to add is

  • 0

I am creating my own IME for device. What I need to add is a TextBox above keyboardView as shown in below image. Although I am able to display it as shown in below image but I am unable to write text into it.

enter image description here

I am extending keyboard view and below is the layout structure

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/wrapper"
    android:layout_height="wrap_content" android:orientation="vertical" 
    android:layout_width="fill_parent" android:background="@color/background" > 

   <TextView android:textAppearance="?android:attr/textAppearanceMedium" android:layout_height="wrap_content" android:id="@+id/txtTest" android:layout_width="fill_parent" android:text="Test" ></TextView>
       <EditText android:inputType="text" android:id="@+id/edtTest" android:layout_height="wrap_content" android:layout_width="fill_parent"></EditText>

<com.keyboard.CustomKeyboardView
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/keyboard"
            android:layout_alignParentBottom="true"
            android:layout_width="fill_parent" android:layout_height="wrap_content"
            android:keyTextSize="15sp"
       />
  </LinearLayout>

public class CustomKeyboardView extends KeyboardView {

static final int KEYCODE_OPTIONS = -100;

private TextView mResultText;
public CustomKeyboardView (Context context, AttributeSet attrs) {
    super(context, attrs);
    }

public CustomKeyboardView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
}

@Override
protected boolean onLongPress(Key key) {
    if (key.codes[0] == Keyboard.KEYCODE_CANCEL) {
        getOnKeyboardActionListener().onKey(KEYCODE_OPTIONS, null);
        return true;
    } else {
        return super.onLongPress(key);
    }
}

Thanks,
Nil

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:42:14+00:00Added an answer on May 26, 2026 at 9:42 am

    You can capture your softkeyboard events and transmit them to your own widgets by implementing KeyboardView.OnKeyboardActionListener.

    In your Inputmethodservice.onKey() Method, you should try to transmit the event to your InputView subviews like this:

    public class mySoftKeyboard 
        extends InputMethodService 
        implements KeyboardView.OnKeyboardActionListener {
    
    // Implementation of KeyboardViewListener inside your InputMethodService
    public void onKey(int primaryCode, int[] keyCodes) {
            //assuming your inputview is in private variable mInputView 
            //and contains public members txtTst and edtTst views 
            //(arrange for this in your InputView.onCreate)
            //Here, we just transmit the onKey code to View.onKeyDown/Up and let views draw themselves
            sendKey( mInputView.txtTst , primaryCode ); // send this to your TextView
            sendKey( mInputView.edtTst , primaryCode ); // also send to your EditText
        }
    
    /**
     * Helper to send a character to the editor as raw key events.
     */
    private void sendKey(View v, int keyCode) {
              v.onKeyDown(keyCode,new KeyEvent(KeyEvent.ACTION_DOWN, keyCode));
              v.onKeyUp  (keyCode,new KeyEvent(KeyEvent.ACTION_UP, keyCode));
    }
        //other interface function, no need to implement
    public void onText(CharSequence text){}
    public void swipeRight() {}
    public void swipeLeft() {}
    public void swipeDown() {}
    public void swipeUp() {}
    public void onPress(int primaryCode) {}
    public void onRelease(int primaryCode) {}
    }
    

    Edit

    To answer your comment about the difference between glyph and keycode, here’s a code snippet that can help you:

    //This snippet tries to translate the glyph 'primaryCode' into key events
    
    //retrieve the keycharacter map from a keyEvent (build yourself a default event if needed)
    KeyCharacterMap myMap=KeyCharacterMap.load(event.getDeviceId()); 
    
    //event list to reproduce glyph
    KeyEvent evs[]=null;
    
    //put the primariCode into an array
    char chars[]=new char[1];
    chars[0]=primaryCode;
    
    // retrieve the key events that could have produced this glyph
    evs=myMap.getEvents(chars);
    
    if (evs != null){
        // we can reproduce this glyph with this key event array
        for (int i=0; i< evs.length;i++) mySendKeyMethodHelper(evs[i]);
    }
    else { /* could not find a way to reproduce this glyph */ }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When creating my own macro, and trying to add it so that anyone can
I'm creating my own templatesystem because I only need a few little operations to
I'm creating my own bidmanager and stumbled upon a certain problem. I am able
I'm creating my own user control that can display n amount of images. Here
I am creating my own custom object, and I am wondering if I need
I am creating my own doclet, and I need to show when a parameter
I'm creating my own little task system in Ruby on Rails, but I need
Is there any resource or book for creating own linux distro.Only good resource i
I am using media player to play audio and video. I am creating own
Im creating my own blog managing app in rails (for experimental purposes).... What would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.