android-dialogfragment
DialogFragment fullscreen shows padding on sides
I figured it out using custom dialog theme. windowIsFloating true will get rid of the background but will add some extra space underneath the background as a background. In which case you can use windowBackground @null to erase it. <style name=”CustomDialog” parent=”@android:style/Theme.Holo.Light” > <item name=”android:windowBackground”>@null</item> <item name=”android:windowIsFloating”>true</item> </style> Usage: AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.CustomDialog); … Read more
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState with DialogFragment
Here is the answer in another thread: Actions in onActivityResult and “Error Can not perform this action after onSaveInstanceState” also here: Refreshing my fragment not working like I thought it should This is an example solving this problem: DialogFragment loadingDialog = createDialog(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(loadingDialog, “loading”); transaction.commitAllowingStateLoss();
IllegalStateException( “You can not set Dialog’s OnCancelListener or OnDismissListener”)
From Android documentation: public Dialog onCreateDialog (Bundle savedInstanceState) Override to build your own custom Dialog container. This is typically used to show an AlertDialog instead of a generic Dialog; when doing so, onCreateView(LayoutInflater, ViewGroup, Bundle) does not need to be implemented since the AlertDialog takes care of its own content. This method will be called … Read more
Android DialogFragment disappears after orientation change
Okay, so the issue seems to be with the DialogFragment compatibility library. The issue was described in this post. “An obsolete DISMISS message for the fragment is retained in the message queue. It’s been queued by DialogFragment.onDestroyView() when dismissing the old dialog and gets reactivated after creating the new dialog. A quick (and possibly dirty) … Read more
Calling DialogFragment’s show() from within onRequestPermissionsResult() causes IllegalStateException in Marshmallow
The bug is accepted and will be fixed, however, I strongly disagree with the postDelayed and timer solutions. The best way to do this would be introducing a state flag in the Activity, in which you set in the callback, and use in onResume or similar. For example: private boolean someFlag; public void onRequestPermissionsResult(int requestCode, … Read more
commitAllowingStateLoss on DialogFragment
I think to prevent throwing IllegalStateException on DialogFragment might be better to use : YourDialogFragment dialogFragment = new YourDialogFragment(); fragmentManager.beginTransaction().add(dialogFragment, YourDialogFragment.TAG_FRAGMENT).commitAllowingStateLoss(); instead of using show() on DialogFragment.