Q:

Null pointer Exception in a fragment while calling getholder fucntion

I am currently getting null pointer exception in a fragment while calling getHolder. 
here's the Code for the fragment
public class Camera_Fragment extends Fragment implements IVideoPlayer, View. OnClickListener {
Button up, dowm, right, left;

SurfaceView CamView;
private String VideoUrl = "http://192.168.0.4:81/videostream.cgi?user=admin&password=admin";

private SurfaceHolder Holder;
private Surface surface = null;
private LibVLC libVLC;

private int mVideoHeight;
private int mVideoWidth;
private int mVideoVisibleHeight;
private int mVideoVisibleWidth;
private int mSarNum;
private int mSarDen;

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.cam1, container, false);
    CamView = (SurfaceView) view.findViewById(R.id. Cam1_CamVIew);

    up = (Button) view.findViewById(R.id. Cam_up);
    dowm = (Button) view.findViewById(R.id. Cam_down);
    right = (Button) view.findViewById(R.id. Cam_right);
    left = (Button) view.findViewById(R.id. Cam_left);

    up.setOnClickListener(Camera_Fragment.this);
    dowm.setOnClickListener(Camera_Fragment.this);
    right.setOnClickListener(Camera_Fragment.this);
    left.setOnClickListener(Camera_Fragment.this);
    return view;
}

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Cam_Play();
}

private void Cam_Play() {
    Holder = CamView.getHolder();
    try {
        libVLC = new LibVLC();
        libVLC.setVout(LibVLC.VOUT_ANDROID_SURFACE);
        libVLC.setHardwareAcceleration(LibVLC.HW_ACCELERATION_AUTOMATIC);
        libVLC.init(getActivity().getApplicationContext());
    } catch (LibVlcException e) {
        e.printStackTrace();
    }
    surface = Holder.getSurface();
    libVLC.attachSurface(surface, this);
    libVLC.playMRL(VideoUrl);
}

The above Code is working flawless in a Activity.. But in the fragment its not .. I am still a biggner in Android development. And i am using fragments for the first time.  Any Solution or suggestion.  
here's the logcat 
11-17 01:03:52.301 5860-5860/com.fyp.tirz.wifisurveillance E/AndroidRuntime: FATAL EXCEPTION: main
11-17 01:03:52.301 5860-5860/com.fyp.tirz.wifisurveillance E/AndroidRuntime: Process: com.fyp.tirz.wifisurveillance, PID: 5860
11-17 01:03:52.301 5860-5860/com.fyp.tirz.wifisurveillance E/AndroidRuntime: java.lang. NullPointerException: Attempt to invoke virtual method 'android.view. SurfaceHolder android.view. SurfaceView.getHolder()' on a null object reference
11-17 01:03:52.301 5860-5860/com.fyp.tirz.wifisurveillance E/AndroidRuntime:     at Fragments. Camera_Fragment.onCreate(Camera_Fragment.java:62)

A:

Remove this. 
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Cam_Play();
}

Add Cam_Play here instead. 
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.cam1, container, false);
    CamView = (SurfaceView) view.findViewById(R.id. Cam1_CamVIew);

    up = (Button) view.findViewById(R.id. Cam_up);
    dowm = (Button) view.findViewById(R.id. Cam_down);
    right = (Button) view.findViewById(R.id. Cam_right);
    left = (Button) view.findViewById(R.id. Cam_left);

    up.setOnClickListener(Camera_Fragment.this);
    dowm.setOnClickListener(Camera_Fragment.this);
    right.setOnClickListener(Camera_Fragment.this);
    left.setOnClickListener(Camera_Fragment.this);

    Cam_Play();   //< ----------------( ADD IT HERE )

    return view;

}

