Is there any way to make dialog like in EditTextPreference outside of PreferenceActivity?
Let’s say I want this dialog to appear on button click in my main Activity.
I’ve tried to build a Dialog with a custom layout but I don’t know how to make it exactly the same as in EditTextPreference.

Sure, basically all you need is an
AlertDialogwith anEditTextas a child view.Short example:
All you do here is creating an
EditTextinstance in code and set it as the dialogs content viasetView(). Just make it final so you can access it from the anonymousOnClickListenerin this example. Of course you can refactor that a bit, but I think it’s already pretty handy.thisis referencing aContexthere. Since you are calling the dialog from anActivity(extendsContext), you should be fine.