Issue
Constructor (note ListPickerHandler)
public StarredListPickerDialogFragment(ListPickerHandler h) {
handler = h;
mSelectedItems = new ArrayList<StarredList>();
}
this is how I call parent fragment methods (defined implementing ListPickerHandler interface)
alertDialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
Button negative = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE);
Button positive = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
positive.setEnabled(false);
negative.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
handler.onNegativeButtonAction(mSelectedItems);
}
});
positive.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
handler.onPositiveButtonAction(mSelectedItems);
}
});
}
});
Now troubles come when android os calls onSaveInstanceState(). Handler is no more defined and I actually have no clues to handle this situation..
Solution
solved by casting (when bundle is not null) the parent fragment to ListPickerHandler which is the interface implemented by the invoking fragment
Answered By - Francesco Donzello
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.