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);
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);
Source: https://habr.com/ru/post/1481144/More articles:Entity Framework stored procedure: Import to complex type function, error retrieving column information - mysqlHow to solve the problem with System.Tuple set several times? - c #WPF TreeView item pressed - eventsWindows 8 notification without notification of application in Windows storage - windows-8Is it possible to exclude / ignore some CSS files from Sass Processor? - cssWebstorm 6 - How to make scsc files ignore - sassobjective-c access to methods from a user cell - iosReceiving email from an android subscription subscriber when purchasing an application - androidTurning an impure virtual function into a pure one in a subclass - c ++Ajax post gets "canceled" - jqueryAll Articles