Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

have to click two times to call an onclick method of edittext android

I have this editText in my android activity

         <EditText
            android:id="@+id/payment_expiration"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/payment_expiration_label"
            android:layout_centerHorizontal="true"
            android:layout_marginLeft="25dp"
            android:layout_marginRight="25dp"
            android:clickable="true"
            android:onClick="update_expiration_date"
            android:editable="false"
            android:layout_marginTop="-4dp"
            android:cursorVisible="false"
            android:maxLength="7"
            android:padding="10dp"
            android:textSize="13dp" />

as you can see when the user click on

I call this method which launch a datePickerDialog :

    public void update_expiration_date(View v){
    Log.i("","cliqué");
    picker.show();
    can_update_expiration_date = true;

}

the problem I encouter is : in the first time just when I open this activity, the user must click two times to launch the dialog

but after that, one click is sufficient

how can I fix this issue

like image 531
begiPass Avatar asked Jan 16 '14 15:01

begiPass


1 Answers

Check Similar Question

"The first click just sets the focus to the TextBox then the second click actually gets handled as a click. "

try setting android:focusable="false"

like image 81
hypd09 Avatar answered Sep 19 '22 15:09

hypd09