jeudi 18 février 2016

Straight away show keyboard in editText when checkBox get checked

So I have an editText , checkbox and spinner in activity.

When checkbox is checked, editText will shown and spinner will be hidden.

 public void addListenerOnTo() // for checkbox
    {

        checkBoxTo.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked) {
                    travelTo.setVisibility(View.INVISIBLE); // spinner
                    addTo.setVisibility(View.VISIBLE); // editText

                } else {
                    travelTo.setVisibility(View.VISIBLE);
                    addTo.setVisibility(View.INVISIBLE);

                }
            }
        });
    }

How can I type the input straight away after the checkbox is checked without pressing the editText to show the keyboard? Thanks.




Aucun commentaire:

Enregistrer un commentaire