singhangadin / android-filepicker

Selecting directories/files made a lot easier.
Apache License 2.0
651 stars 139 forks source link

canceListener does not work #61

Closed omidaminiva closed 7 years ago

omidaminiva commented 7 years ago

I have an activity that if user taps on cancel I like to call finish(); but when tap on cancel button

dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialog) {

                }
            });

does not work, I also tried

dialog.findViewById(R.id.cancel).setOnClickListener but get dialog.findViewById(R.id.cancel) is null

the only thing works is

dialog.setOnDismissListener but that is working if user presses submit and cancel. So I would not know which one is pressed.

singhangadin commented 7 years ago

Hey, I think you are looking for a way to differentiate between a select and a cancel dismiss, for which you can also check what was the size of file path array in callback. Size zero is a cancel and selection in all other cases.

omidaminiva commented 7 years ago

right and that is good work around. but if we call cancel on cancel and dismiss on dismiss listener work properly. please have a look at my pull request