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

I am not using fragments. How can I get the dialog to work with Activity? #43

Closed Brblol closed 10 years ago

tomas-vondracek commented 10 years ago

Dialogs work the same way in activity as in Fragment:

SimpleDialogFragment.createBuilder(this, getSupportFragmentManager()).setMessage(R.string.message).show();

You just need to pass in the FragmentManager. Please note, that the library has android support library as dependency and you need the FragmentManager from support lib. To get callbacks into the activity, you need to do the same as in fragment - make your activity implement the callback interface, e.g. ISimpleDialogListener and that's it.