After going through:
Unable to add window -- token null is not valid; is your activity running?
Android 'Unable to add window -- token null is not for an application' exception
Problems creating a Popup Window in Android Activity
It returns null when I use getView() to get root View of the Fragment in the ViewPager
I'm not entirely sure if having a null View element as root causes this exception. I have a DialogFragment:
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.acquire_fragment, container, false);
    mErrorTextView = root.findViewById(R.id.error_textview);
    mRecyclerView = root.findViewById(R.id.list);
    mLoadingView = root.findViewById(R.id.screen_wait);
    Toolbar toolbar = root.findViewById(R.id.toolbar);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_up);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dismiss();
            mListener.onFinishActivity();
        }
    });
    toolbar.setTitle(R.string.button_purchase);
    return root;
}
Can root be null when .findViewById() is called?
