Try this..
Change View name
final View main_view = inflater.inflate(R.layout.record_fragment, null);
builder.setView(main_view).setPositiveButton("Save experiment", null);
and use it
EditText x = (EditText) main_view.findViewById(R.id.name);
because in your public void onClick(View view) {
onclick has view
that edit text need to refer inflated
view. Not onclick view.
Or
As like @Raghunandan said change onclick view
name as public void onClick(View v) {