How to make DialogFragment width to Fill_Parent

This is the solution I figured out to handle this issue: @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = super.onCreateDialog(savedInstanceState); dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE); return dialog; } @Override public void onStart() { super.onStart(); Dialog dialog = getDialog(); if (dialog != null) { dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); } } Edit: You can use the code below in onCrateView … Read more

DialogFragment setCancelable property not working

@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.dialog_test, container, true); getDialog().requestWindowFeature(STYLE_NO_TITLE); getDialog().setCancelable(false); return view; } instead of getDialog().setCancelable(false); you have to use directly setCancelable(false); so the updated answer will be like this @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.dialog_test, container, true); getDialog().requestWindowFeature(STYLE_NO_TITLE); … Read more

Show dialog from fragment?

I must cautiously doubt the previously accepted answer that using a DialogFragment is the best option. The intended (primary) purpose of the DialogFragment seems to be to display fragments that are dialogs themselves, not to display fragments that have dialogs to display. I believe that using the fragment’s activity to mediate between the dialog and … Read more

passing argument to DialogFragment

Using newInstance public static MyDialogFragment newInstance(int num) { MyDialogFragment f = new MyDialogFragment(); // Supply num input as an argument. Bundle args = new Bundle(); args.putInt(“num”, num); f.setArguments(args); return f; } And get the Args like this @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mNum = getArguments().getInt(“num”); … } See the full example here http://developer.android.com/reference/android/app/DialogFragment.html

How to correctly dismiss a DialogFragment?

tl;dr: The correct way to close a DialogFragment is to use dismiss() directly on the DialogFragment. Details: The documentation of DialogFragment states Control of the dialog (deciding when to show, hide, dismiss it) should be done through the API here, not with direct calls on the dialog. Thus, you should not use getDialog().dismiss(), since that … Read more

How to set the title of DialogFragment?

You can use getDialog().setTitle(“My Dialog Title”) Just like this: public static class MyDialogFragment extends DialogFragment { … @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Set title for this dialog getDialog().setTitle(“My Dialog Title”); View v = inflater.inflate(R.layout.mydialog, container, false); // … return v; } // … }

Callback to a Fragment from a DialogFragment

Activity involved is completely unaware of the DialogFragment. Fragment class: public class MyFragment extends Fragment { int mStackLevel = 0; public static final int DIALOG_FRAGMENT = 1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { mStackLevel = savedInstanceState.getInt(“level”); } } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt(“level”, mStackLevel); } void … Read more

Full Screen DialogFragment in Android

To get DialogFragment on full screen Override onStart of your DialogFragment like this: @Override public void onStart() { super.onStart(); Dialog dialog = getDialog(); if (dialog != null) { int width = ViewGroup.LayoutParams.MATCH_PARENT; int height = ViewGroup.LayoutParams.MATCH_PARENT; dialog.getWindow().setLayout(width, height); } } And thanks very much to this post: The-mystery-of-androids-full-screen-dialog-fragments

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)