2

I have my own custom keyboard in my app . In the editText box i disabled its onTouch() by returning true

OnTouchListener otl = new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                switch (event.getAction()) {
                }
                return true;
            }
        };

This helps in preventing keyboard to popup.But it also disables the touch event, and i am not getting the option to copy paste default feature of android .This scenario is happening in many app but i am not getting any way to do it. Please help.

kaddy
  • 109
  • 11

2 Answers2

0

Instead of disabling touch, you can setFocusable to false. This will disable the softkeyboard for popping up.

editText.setFocusable(false);    
editText.setFocusableInTouchMode(false);

And then in onTouch, popup your custom keyboard

Hope this helps.

Mustansar Saeed
  • 2,730
  • 2
  • 22
  • 46
0

Actually using the below set of properties in edit text xml and setting text in selectable as true ,despite of returning false in my onTouch() solved my problem .

<EditText
            android:id="@+id/numberEditText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clickable="true"
            android:textCursorDrawable="@null"
            android:ems="10"
            android:paddingRight="3dip"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:gravity="center_vertical|end"
            android:cursorVisible="true"
            android:background="@drawable/edittext_style_dialer"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColorHint="@color/dialer_text_color"
            android:textSize="@dimen/dialer_text_size" >

            <requestFocus />
        </EditText>

In the onCreate(),

mNumberInputEditText.setTextIsSelectable(true);
kaddy
  • 109
  • 11