Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Needing to double click EditText for click listener to respond

I have a section of code where I want to change the text showing in a textView when the user selects an EditText box.

The problem I am having is that the textView only changes when I double click the EditText box, one click and there is no change to the textView.

Is there another click listener that I should be using?

final EditText box0105 = (EditText)findViewById(R.id.box0105);
final TextView txtHint = (TextView)findViewById(R.id.txtHint);
        box0105.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            txtHint.setText(onOneClick);                
        }
    });
like image 331
Kurt Avatar asked Nov 21 '12 15:11

Kurt


2 Answers

Add android:focusableInTouchMode="false" in EditText xml then EditText will accept single click

like image 87
ρяσѕρєя K Avatar answered Sep 23 '22 20:09

ρяσѕρєя K


Try setting OnTouchListener rather than OnClickListener

like image 26
arjoan Avatar answered Sep 19 '22 20:09

arjoan