1

I have implemented token auto complete text view on EditText. My issue is that I want the keyboard to be shown on a single click on an EditText rather than on double click.

completionView.setOnFocusChangeListener(new OnFocusChangeListener() {

        @Override
        public void onFocusChange(View v, boolean hasFocus) {

            if(!hasFocus)
            {
                Log.d("inside>>>>>>>>>>>", "out of focus add");
                InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(completionView.getWindowToken(), 0);
                onFocus();
            }
            else
            {
                Log.d("et_contacts","focusing to hide");
                onFocus();
            }
        }
    });
    completionView.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.showSoftInput(completionView, InputMethodManager.SHOW_IMPLICIT);
        }
    });`
balaji koduri
  • 1,321
  • 9
  • 25
Asif Sb
  • 785
  • 9
  • 38
  • @balajikoduri: please keep in mind inline code spans (`like this`) [shouldn't be used for emphasis](http://meta.stackoverflow.com/questions/254990/when-should-code-formatting-be-used-for-non-code-text), only for code within sentences. Also, please try and improve the post as much as you can when editing a post, it makes other people's lives easier. See the [editing guidelines](http://stackoverflow.com/help/editing) for more information. Thanks! – Qantas 94 Heavy Jan 20 '15 at 12:48

1 Answers1

2

try this:

     completionView.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            completionView.requestFocus();
            InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.showSoftInput(completionView, 0);
        }
    });

write on click listener for the edit text and write this code in onClick() method.

balaji koduri
  • 1,321
  • 9
  • 25