FragmentActivity show a dialog when clicking an Action Button in the Action BarDialogFragment
Thanks to @Tommy Visic for writing a really good description it worked.
Posting the code which worked for me.
I have removed the Dialog building code from the onCreateDialog method infact removed onCreateDialog method and the dialog view which I have been implementing in the Dialog's custom view I have included it as a View in the onCreateView method and all the things started working.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.login_sigup_screen, null, false);
bind = ButterKnife.bind(this, view);
initViewPager();
return view;
}
Faced one more problem with this implementation is:
When a Activity has Toolbar/ActionBar then it is also displayed into the DialogFragment to avoid that what is to be done is:
Implement onViewCreated method of Fragment and add below code
Dialog dialog = getDialog();
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
float dimAmount = 0.6f;
dialog.getWindow().setDimAmount(dimAmount);
This will remove the Toolbar from the DialogFragment and Activity will be displayed as it is.
Cheers
Thanks @Tommy
Regards Zeus