The getLayoutInflater (Bundle) method in a type fragment is not applicable for arguments ()

I'm trying to use custom datePicker date picker

but I get this error when inflating the root layout inside the fragment:

public void button_click(View view) { // Create the dialog final Dialog mDateTimeDialog = new Dialog(view.getContext()); // Inflate the root layout final RelativeLayout mDateTimeDialogView = (RelativeLayout)getLayoutInflater() .inflate(R.layout.datepick,false); ..... 

How can i fix this?

EDIT

This code works:

 // Inflate the root layout LayoutInflater inflater = (LayoutInflater) view.getContext().getSystemService( Context.LAYOUT_INFLATER_SERVICE ); final RelativeLayout mDateTimeDialogView = (RelativeLayout) inflater.inflate(R.layout.datepick, null); 
+4
source share
1 answer

if you have a parental view, get as a bloat argument. eq: view.inflate (int resource, ViewGroup root, boolean attachToRoot);

 view.inflate(int resource, parentView, false); 
+2
source

Source: https://habr.com/ru/post/1481144/


All Articles