I have three EditText boxes in an activity, for two of which normal
input methods (hard keys, default soft keyboard) are ok. But for one
of the EditText boxes I want to send soft input only from a custom
keyboard view. So in effect I wanted the default soft keyboard never
to be shown for this EditText. I tried adding onTouchListeners and
onFocusChange listeners for the EditText with partial success like
this:

public boolean onTouch(View v, MotionEvent event) {
    v.requestFocus();
    imm.toggleSoftInput(0, 0);
    return true;
}

public void onFocusChange(View v, boolean hasFocus) {
    InputMethodManager imm =
(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm.isActive(v)) {
        imm.toggleSoftInput(0,0);
    }
}


I did not achieve a definitive solution because

1)the default soft keyboard always briefly flashes visible before the
listener hides it

2)on some occasions, such as moving focus to the EditText with hard
keyboard arrow keys sometimes sets the default soft keyboard visible

and so on.

So I would love to find a simple way to tell Android never to show the
default soft keyboard for this specific EditText. I would not like to
extend EditText and start to override stuff, since the EditText
functionality is perfect for me - I just want the default soft
keyboard not to be shown.

I've spent days now trying to figure this out. Some topics (including
some here) found via googling have half-way attempts at this problem,
but so far I haven't found a single totally functional solution.

I decided I could also try not to use EditText but whatever other View
that will get the job done. It turns out it is very hard to get rid of
that soft keyboard. It even shows up when I use the hard keys to move
focus from an EditText to a Button! Why on earth should the soft
keyboard be shown on every View that happens to have focus? Even when
I explicitly say inputType="none"? How do I turn that %ยค#"! soft
keyboard OFF? Below is the xml for the Button - let's use that as an
example:

<Button
    android:id="@+id/OkButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:inputType="none"
    android:paddingRight="5mm"
    android:paddingLeft="5mm"
    android:layout_below="@id/Volume"
    android:layout_alignParentLeft="true"
    android:text="OK"/>


It would make my day if one of you guys could help me out here!

-- 
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