I have a function that when triggered, succesfully displays a DialogFragment with the following code
DialogFragment
DialogFragment dialog;
View dialogView;
Context activityContext;
...
dialog = new DialogFragment(){
@Override public Dialog onCreateDialog(Bundle savedInstanceState) {
dialogView = getActivity().getLayoutInflater().inflate(R.layout.customView, null);
...
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setView(dialogView);
return builder.create();
}
};
dialog.show(activityContext.getSupportFragmentManager() , "MyDialog");
The problem is, after I add a System Alert window with the following code the DialogFragment no longer shows, BUT if I pass to another app, when my app minimizes I can see the DialogFragment while it's reducing it's size
System Alert Window
WindowManager mWindowManager;
WindowManager.LayoutParams params;
...
mWindowManager = (WindowManager)activityContext.getSystemService(Context.WINDOW_SERVICE);
params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT
}
params.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
addView(((LayoutInflater)activityContext.getSystemService("layout_inflater")).inflate(R.layout.floatingBotton, null));
So... Why can't I see my dialog at the top (as far as I understand, the dialog is displaying) Why it only happens when the System alert window is displayed
I've tried with other flags for the System Alert Window, but I have the same problem with the ones that I've tried
dialog.show
method is of your own ? show method of dialog is deprecated in API Level 13, you need to use fragment manager to show your dialog. Show the Dialog Fragment class for better understanding.. – BaucisDialogFragment
will show on top of other layouts. Precedence given to the last displayed on screen. – Baucis