[Solved] Unexpected NullpointExpection inside a setter [duplicate]
The title is still null when you are calling mAlertDialog dialog = new mAlertDialog(); dialog.setTheTitle(getActivity().getString(R.string.invalidTimeTitle)); so what you can do is public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.dialog_invalid_time, container, false); title = (TextView)view.findViewById(R.id.titleText); setTheTitle(getActivity().getString(R.string.invalidTimeTitle)); return view; } // call it mAlertDialog dialog = new mAlertDialog(); dialog.show(fm, “InvalidTime”); 2 solved … Read more