mercredi 29 juin 2016

How to skip DialogFragment but still invoke the positive button callback?

Given the following piece of code:

Code:

public void showMyDialogFragment(String name) {
    // (...code...)
    MyDialogFragment.newInstance(name).show(getFragmentManager(), MyDialogFragment.TAG); // MyDialog Fragment exetends DialogFragment
    // (...code...)
}

@Override
public void onMyDialogResult(boolean ok) {
    // (...code...)
}

MyDialogFragment will show a dialog with "OK" and "Cancel". Clicking any of these buttons will fire the onMyDialogResult callback with either true or false according to the button pressed.

I'm trying to create a module where I skip the dialog entirely and fire the callback with true as the argument. Basically simulating a press on the positive button.

Any suggestions on how to achieve this?


from xda-developers http://ift.tt/297g4vW
via IFTTT

Aucun commentaire:

Enregistrer un commentaire