android-dialogfragment

Full Screen DialogFragment in Android

百般思念 提交于 2019-11-26 04:34:40
问题 I\'m trying to show an almost fullscreen DialogFragment. But I\'m somehow not able to do so. The way I am showing the Fragment is straight from the android developer documentation FragmentManager f = ((Activity)getContext()).getFragmentManager(); FragmentTransaction ft = f.beginTransaction(); Fragment prev = f.findFragmentByTag(\"dialog\"); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); // Create and show the dialog. DialogFragment newFragment = new DetailsDialogFragment();

Callback to a Fragment from a DialogFragment

痞子三分冷 提交于 2019-11-26 02:04:27
问题 Question: How does one create a callback from a DialogFragment to another Fragment. In my case, the Activity involved should be completely unaware of the DialogFragment. Consider I have public class MyFragment extends Fragment implements OnClickListener Then at some point I could do DialogFragment dialogFrag = MyDialogFragment.newInstance(this); dialogFrag.show(getFragmentManager, null); Where MyDialogFragment looks like protected OnClickListener listener; public static DialogFragment

How to create a Custom Dialog box in android?

帅比萌擦擦* 提交于 2019-11-25 22:55:50
问题 I want to create a custom dialog box like below I have tried the following things. I created a subclass of AlertDialog.Builder and used a custom Title and Custom Content View and used that but the result was not as expected. Another attempt was to subclass DialogFragment and customize the dialog inside onCreateDialog that but result was not as expected. Then I tried using a plain Dialog class. The result was not as expected. In all three cases, the problem is when I overlook the title view

How to prevent a dialog from closing when a button is clicked

与世无争的帅哥 提交于 2019-11-25 21:55:45
问题 I have a dialog with EditText for input. When I click the \"yes\" button on dialog, it will validate the input and then close the dialog. However, if the input is wrong, I want to remain in the same dialog. Every time no matter what the input is, the dialog should be automatically closed when I click on the \"no\" button. How can I disable this? By the way, I have used PositiveButton and NegativeButton for the button on dialog. 回答1: EDIT: This only works on API 8+ as noted by some of the