[android-developers] Re: Completely disable Soft Keyboard from EditText
**Try this one, works fine for me:** public class CustomEdittext extends EditText { Boolean mIsTextEditor=true; public CustomEdittext(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub } @Override public boolean onCheckIsTextEditor() { // TODO Auto-generated method stub return mIsTextEditor; } @Override public boolean onTouchEvent(MotionEvent event) { // TODO Auto-generated method stub mIsTextEditor=false; Boolean mOnTouchEvent=super.onTouchEvent(event); mIsTextEditor=true; return mOnTouchEvent; } } Note: You nee to add ` this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); ` on your activity or else keyboard will popup at first time. On Tuesday, February 15, 2011 1:34:26 PM UTC+5:30, kahsa wrote: > > I used TextView insted of EditText with > - Focasable in touch mode: true > - Style: @android:style/Widget.EditText, which is default EditText > style, via res/values/mystyles.xml > > It looks like EditText but NO soft keyboards opened. > However when set Input type to the TextView, soft keyboard is shown. > > hope this helps you. > > -- 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
[android-developers] Re: Completely disable Soft Keyboard from EditText
I used TextView insted of EditText with - Focasable in touch mode: true - Style: @android:style/Widget.EditText, which is default EditText style, via res/values/mystyles.xml It looks like EditText but NO soft keyboards opened. However when set Input type to the TextView, soft keyboard is shown. hope this helps you. -- 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
[android-developers] Re: Completely disable Soft Keyboard from EditText
Hari: this is exactly what I'd like to do. The EditText will be used to input a specific value with only certain units allowed. So I have extended android.inputmethodservice.Keyboard and use it together with android.inputmethodservice.KeyboardView so that the keyboard only shows the characters that make sense in this specific context. So far the solution I have come up with is to get a handle on the InputMethodManager (imm) and add OnFocus-, OnClick- and OnTouchListener's for the EditText which all call the following helper method: private boolean makeActive(View v) { imm.hideSoftInputFromWindow(v.getWindowToken(), 0); EditText e = (EditText) v; int iType = e.getInputType(); e.setInputType(InputType.TYPE_NULL); e.requestFocus(); showKb(); e.setInputType(iType); e.setSelection(e.getText().length()); return true; } protected void showKb() { this.kbView.setVisibility(View.VISIBLE); Here kbView is the KeyboardView connected to my custom keyboard. So far this works - but it's not very elegant nor am I sure it is an optimal solution. But as said, it's the only thing that works for me so far. I'd be glad to receive some comments on your behalf. On Feb 6, 3:51 pm, Hari Edo wrote: > I think he said he had a special soft keyboard that was to be used for > this field. Sounds like he doesn't want to go through the whole > hassle > of creating an entire soft keyboard, nor creating all the caret- > position > and backspace-handling code necessary to reinvent EditView. I don't > know the actual situation but imagine a Scrabble tile rack that only > let > you enter the letters in your rack, plus a backspace and DONE key. > > On Feb 6, 2:26 am, Dianne Hackborn wrote: > > > Can I first ask, what are you trying to accomplish? What is the purpose of > > having an editable text view if the user can't actually put text into it? > > > On Tue, Feb 1, 2011 at 10:29 AM, zenperttu wrote: > > > Hi! > > > > I would like a way to turn off showing the current soft keyboard for > > > an EditText. I have a custom View that provides the soft input needed > > > for an EditText, so on every occasion (on click, on focus change, on > > > touch...) when by default the soft keyboard would be shown, I want it > > > NOT to be shown. > > > > The closest things I found are > > > >http://groups.google.com/group/android-developers/browse_thread/threa... > > > > and > > > >http://stackoverflow.com/questions/1109022/how-to-close-hide-the-andr... > > > > and > > > >http://stackoverflow.com/questions/1109022/how-to-close-hide-the-andr... > > > > These however do not work for me. > > > > The solution suggested in the latter > > > > InputMethodManager imm = > > > (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); > > > imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0); > > > > for example works only after the EditText has been selected by the > > > user and is already accepting input and so the soft keyboard is > > > already on the screen. I want it never to appear. > > > > I can try to implicitly set all of the onFocusChangeListener, > > > onTouchListener, onClickListener to do > > > > public void onSomeActionListener(View v) { > > > > InputMethodManager imm = (InputMethodManager) > > > context.getSystemService(Context.INPUT_METHOD_SERVICE); > > > if (imm.isActive(v)) { > > > imm.toggleSoftInput(0,0); > > > } > > > } > > > > However, this is really not a nice solution because > > > > 1) the soft keyboard is first called and shown so that it briefly > > > flashes on the screen before disappearing > > > > 2) I can't by trial and error try to find all the different ways user > > > could cause soft keyboard to be shown and override all corresponding > > > methods > > > > Thanks for your help! > > > > -- > > > 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 > > > -- > > Dianne Hackborn > > Android framework engineer > > hack...@android.com > > > Note: please don't send private questions to me, as I don't have time to > > provide private support, and so won't reply to such e-mails. All such > > questions should be posted on public forums, where I and others can see and > > answer them. > > -- 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-de
[android-developers] Re: Completely disable Soft Keyboard from EditText
I think he said he had a special soft keyboard that was to be used for this field. Sounds like he doesn't want to go through the whole hassle of creating an entire soft keyboard, nor creating all the caret- position and backspace-handling code necessary to reinvent EditView. I don't know the actual situation but imagine a Scrabble tile rack that only let you enter the letters in your rack, plus a backspace and DONE key. On Feb 6, 2:26 am, Dianne Hackborn wrote: > Can I first ask, what are you trying to accomplish? What is the purpose of > having an editable text view if the user can't actually put text into it? > > > > > > > > > > On Tue, Feb 1, 2011 at 10:29 AM, zenperttu wrote: > > Hi! > > > I would like a way to turn off showing the current soft keyboard for > > an EditText. I have a custom View that provides the soft input needed > > for an EditText, so on every occasion (on click, on focus change, on > > touch...) when by default the soft keyboard would be shown, I want it > > NOT to be shown. > > > The closest things I found are > > >http://groups.google.com/group/android-developers/browse_thread/threa... > > > and > > >http://stackoverflow.com/questions/1109022/how-to-close-hide-the-andr... > > > and > > >http://stackoverflow.com/questions/1109022/how-to-close-hide-the-andr... > > > These however do not work for me. > > > The solution suggested in the latter > > > InputMethodManager imm = > > (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); > > imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0); > > > for example works only after the EditText has been selected by the > > user and is already accepting input and so the soft keyboard is > > already on the screen. I want it never to appear. > > > I can try to implicitly set all of the onFocusChangeListener, > > onTouchListener, onClickListener to do > > > public void onSomeActionListener(View v) { > > > InputMethodManager imm = (InputMethodManager) > > context.getSystemService(Context.INPUT_METHOD_SERVICE); > > if (imm.isActive(v)) { > > imm.toggleSoftInput(0,0); > > } > > } > > > However, this is really not a nice solution because > > > 1) the soft keyboard is first called and shown so that it briefly > > flashes on the screen before disappearing > > > 2) I can't by trial and error try to find all the different ways user > > could cause soft keyboard to be shown and override all corresponding > > methods > > > Thanks for your help! > > > -- > > 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 > > -- > Dianne Hackborn > Android framework engineer > hack...@android.com > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them. -- 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
Re: [android-developers] Re: Completely disable Soft Keyboard from EditText
ok please leason to me now i know like your about ok what is you live what is you name what is you work your about i don't no so sorry i see your bey bey On Sat, Feb 5, 2011 at 10:53 PM, zenperttu wrote: > Hi! Thanks for your answer. Unfortunately setting editable="false" > does not do the trick. When I'm moving the focus via hard keys from a > normal EditText to the View where I'd like not to have soft keyboard > shown it still stays on the screen. > > ps. Sorry I didn't answer earlier, I couldn't find my post for some > reason and actually reposted it, so I missed your answer. > > On Feb 4, 4:12 am, Brill Pappin wrote: > > There doesn't seem to be an ime option in EditorInfo to disable the > > soft keyboard. > > > > Can you make the view editable==false but still capture touch/select > > events? > > Making it non-editable may prevent the keyboard from popping up. > > > > - Brill Pappin > > > > On Feb 1, 1:29 pm, zenperttu wrote: > > > > > Hi! > > > > > I would like a way to turn off showing the current soft keyboard for > > > an EditText. I have a custom View that provides the soft input needed > > > for an EditText, so on every occasion (on click, on focus change, on > > > touch...) when by default the soft keyboard would be shown, I want it > > > NOT to be shown. > > > > > The closest things I found arehttp:// > groups.google.com/group/android-developers/browse_thread/threa... > > > > > and > > > > >http://stackoverflow.com/questions/1109022/how-to-close-hide-the-andr. > .. > > > > > and > > > > >http://stackoverflow.com/questions/1109022/how-to-close-hide-the-andr. > .. > > > > > These however do not work for me. > > > > > The solution suggested in the latter > > > > > InputMethodManager imm = > > > (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); > > > imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0); > > > > > for example works only after the EditText has been selected by the > > > user and is already accepting input and so the soft keyboard is > > > already on the screen. I want it never to appear. > > > > > I can try to implicitly set all of the onFocusChangeListener, > > > onTouchListener, onClickListener to do > > > > > public void onSomeActionListener(View v) { > > > > > InputMethodManager imm = (InputMethodManager) > > > context.getSystemService(Context.INPUT_METHOD_SERVICE); > > > if (imm.isActive(v)) { > > > imm.toggleSoftInput(0,0); > > > } > > > > > } > > > > > However, this is really not a nice solution because > > > > > 1) the soft keyboard is first called and shown so that it briefly > > > flashes on the screen before disappearing > > > > > 2) I can't by trial and error try to find all the different ways user > > > could cause soft keyboard to be shown and override all corresponding > > > methods > > > > > Thanks for your help! > > > > > > -- > 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 > -- 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
[android-developers] Re: Completely disable Soft Keyboard from EditText
Hi! Thanks for your answer. Unfortunately setting editable="false" does not do the trick. When I'm moving the focus via hard keys from a normal EditText to the View where I'd like not to have soft keyboard shown it still stays on the screen. ps. Sorry I didn't answer earlier, I couldn't find my post for some reason and actually reposted it, so I missed your answer. On Feb 4, 4:12 am, Brill Pappin wrote: > There doesn't seem to be an ime option in EditorInfo to disable the > soft keyboard. > > Can you make the view editable==false but still capture touch/select > events? > Making it non-editable may prevent the keyboard from popping up. > > - Brill Pappin > > On Feb 1, 1:29 pm, zenperttu wrote: > > > Hi! > > > I would like a way to turn off showing the current soft keyboard for > > an EditText. I have a custom View that provides the soft input needed > > for an EditText, so on every occasion (on click, on focus change, on > > touch...) when by default the soft keyboard would be shown, I want it > > NOT to be shown. > > > The closest things I found > > arehttp://groups.google.com/group/android-developers/browse_thread/threa... > > > and > > >http://stackoverflow.com/questions/1109022/how-to-close-hide-the-andr... > > > and > > >http://stackoverflow.com/questions/1109022/how-to-close-hide-the-andr... > > > These however do not work for me. > > > The solution suggested in the latter > > > InputMethodManager imm = > > (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); > > imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0); > > > for example works only after the EditText has been selected by the > > user and is already accepting input and so the soft keyboard is > > already on the screen. I want it never to appear. > > > I can try to implicitly set all of the onFocusChangeListener, > > onTouchListener, onClickListener to do > > > public void onSomeActionListener(View v) { > > > InputMethodManager imm = (InputMethodManager) > > context.getSystemService(Context.INPUT_METHOD_SERVICE); > > if (imm.isActive(v)) { > > imm.toggleSoftInput(0,0); > > } > > > } > > > However, this is really not a nice solution because > > > 1) the soft keyboard is first called and shown so that it briefly > > flashes on the screen before disappearing > > > 2) I can't by trial and error try to find all the different ways user > > could cause soft keyboard to be shown and override all corresponding > > methods > > > Thanks for your help! > > -- 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
[android-developers] Re: Completely disable Soft Keyboard from EditText
There doesn't seem to be an ime option in EditorInfo to disable the soft keyboard. Can you make the view editable==false but still capture touch/select events? Making it non-editable may prevent the keyboard from popping up. - Brill Pappin On Feb 1, 1:29 pm, zenperttu wrote: > Hi! > > I would like a way to turn off showing the current soft keyboard for > an EditText. I have a custom View that provides the soft input needed > for an EditText, so on every occasion (on click, on focus change, on > touch...) when by default the soft keyboard would be shown, I want it > NOT to be shown. > > The closest things I found > arehttp://groups.google.com/group/android-developers/browse_thread/threa... > > and > > http://stackoverflow.com/questions/1109022/how-to-close-hide-the-andr... > > and > > http://stackoverflow.com/questions/1109022/how-to-close-hide-the-andr... > > These however do not work for me. > > The solution suggested in the latter > > InputMethodManager imm = > (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); > imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0); > > for example works only after the EditText has been selected by the > user and is already accepting input and so the soft keyboard is > already on the screen. I want it never to appear. > > I can try to implicitly set all of the onFocusChangeListener, > onTouchListener, onClickListener to do > > public void onSomeActionListener(View v) { > > InputMethodManager imm = (InputMethodManager) > context.getSystemService(Context.INPUT_METHOD_SERVICE); > if (imm.isActive(v)) { > imm.toggleSoftInput(0,0); > } > > } > > However, this is really not a nice solution because > > 1) the soft keyboard is first called and shown so that it briefly > flashes on the screen before disappearing > > 2) I can't by trial and error try to find all the different ways user > could cause soft keyboard to be shown and override all corresponding > methods > > Thanks for your help! -- 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