Y
Y
ywitodenasuby2018-09-03 17:36:58
Android
ywitodenasuby, 2018-09-03 17:36:58

EditText is not responding to any events why?

There is an EditText, I want to catch at least some event, but the reaction is zero.

<EditText
        android:id="@+id/etSelectCity"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:ems="10"
        android:hint="Город"
        android:inputType="textPersonName"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/gvPhotos" />

// город
        EditText etCity = (EditText)findViewById(R.id.etSelectCity);
        //adSellerName = etSellerName.getText().toString();
        etCity.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.d(TAG, "ddddddddd");
                Toast.makeText(getBaseContext(), "1",Toast.LENGTH_SHORT).show();
            }
        });

As soon as I did not try, but the event always does not work. Tried both click and focus, but nothing, why?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AlexeyID, 2018-09-03
@AlexeyID

Use the addTextChangedListener method
Example: dolbodub.blogspot.com/2013/03/edittext.html?m=1

Y
ywitodenasuby, 2018-09-03
@ywitodenasuby

Well, as usual. Problem solved. Simply the event handler was hung up on pushing of the button. I accidentally put it there and did not notice.)) Thank you all!))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question