I`m trying to set title text size for DialogFragment
I coded for my old test device (Android 5.0 API 21) and all was ok
But app falls after I began to use new test device (Android 8.1 API 27)
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_multiple_info_dialog, null, false);
getDialog().setTitle(R.string.dialog_fragment_BAC_info_title);
TextView title = getDialog().findViewById(android.R.id.title);
title.setTextSize(30);
title.setTextColor(getResources().getColor(R.color.white));
it falls at the line setTextSize(30) with error
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setTextSize(float)' on a null object reference
Yes, log say me that title == null
I tried to replace part of code to onDialogCreate(Bundle savedInstanceState)...
But same thing - now app falls on same line inside onDialogCreate...
Any ideas how to fix it?
from Gradle
compileSdkVersion 27
minSdkVersion 21
targetSdkVersion 27