avast / android-styled-dialogs

Backport of Material dialogs with easy-to-use API based on DialogFragment
Apache License 2.0
2.15k stars 450 forks source link

IListDialogListener -> onListItemSelected(String s, int i) i is always 0. #82

Closed ghost closed 9 years ago

ghost commented 9 years ago

I have this code:

ListDialogFragment.SimpleListDialogBuilder simpleListDialogBuilder = new ListDialogFragment.SimpleListDialogBuilder(getActivity().getApplicationContext(), getFragmentManager());

            simpleListDialogBuilder
                    .setTitle("titleString")
                    .setItems((R.array.array_items))
                    .setTargetFragment(this, item.getId())
                    .show();

I tried with .setTargetFragment(this, 5) but on onListItemSelected(String s, int i) of IListDialogListener i always is 0.

however (other code) in onPositiveButtonClicked(int i) of ISimpleDialogListener i does have the correct value.

davidvavra commented 9 years ago

Hi, setTargetFragment() method should not be used for identifying which item was pressed. Please use IListDialogListener for that.