0

how can I detect the down arrow on the keypad.

I have an edit text, when it is clicked i open a number keypad, I want to detect when the keyboard is closed by clicking on the down arrow as shown in the pic.

I tried etCostLimit.setOnFocusChangeListener this method is not triggered when down arrow is pressed on the keypad.

I tried onBackPressed() but that got triggered only when I moved back to the previous activity.

How can I know when the down arrow is clicked, what I want to do then is to hide the confirm and cancel buttons.

     <EditText
                        android:id="@+id/etCostLimit"
                        style="@style/EditText"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="8dp"
                        android:gravity="center_horizontal"
                        android:inputType="numberSigned|numberDecimal"
                        android:digits="0123456789.,-"
                        android:hint="@string/charge_restrictions_cost_placeholder"
                        app:layout_constraintWidth_percent="0.30"
                        app:layout_constraintStart_toEndOf="@+id/tvNeverChangeOver"
                        app:layout_constraintTop_toBottomOf="@+id/dividerLineHorizontal" />

override fun onBackPressed(): Boolean {
    Log.d("PriceLimitFragment", "onBackPressed")
    return super.onBackPressed()

}

 etCostLimit.setOnFocusChangeListener { v, hasFocus ->
        updateSaveBtnEnabledStatus(hasFocus)
    }

thanks in advance R

enter image description here

BRDroid
  • 3,190
  • 6
  • 43
  • 100

0 Answers0