Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
<p>Im having this error : </p>

<pre><code>java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
                                                                                           at mt.edu.mcast.navigationfragmentsexample.BlankFragment2.onCreateView(BlankFragment2.java:92)
</code></pre>

<p>This is the code in the java BlankFragment2:</p>

<pre><code> public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_blank_fragment2,container,false);
    final EditText etName = (EditText) this.getActivity().findViewById(R.id.etName);
    final EditText etSurname = (EditText) this.getActivity().findViewById(R.id.etSurname);
    final EditText etUsername = (EditText) this.getActivity().findViewById(R.id.etUsername);
    final EditText etPassword = (EditText) this.getActivity().findViewById(R.id.etPassword);
    final EditText etEmail = (EditText) this.getActivity().findViewById(R.id.etEmail);
    final EditText etPhone = (EditText) this.getActivity().findViewById(R.id.etPhone);
    final EditText etAge = (EditText) this.getActivity().findViewById(R.id.etAge);
    final Button bRegister = (Button) this.getActivity().findViewById(R.id.bRegister);
</code></pre>

<p>At this point error v</p>

<pre><code>   bRegister.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            final String name = etName.getText().toString();
            final String surname = etSurname.getText().toString();
            final String username = etUsername.getText().toString();
            final String password = etPassword.getText().toString();
            final String email = etEmail.getText().toString();
            final int phone = Integer.parseInt(etPhone.getText().toString());
            final int age = Integer.parseInt(etAge.getText().toString());

            Response.Listener&lt;String&gt; responseListener = new Response.Listener&lt;String&gt;() {
                @Override
                public void onResponse(String response) {
                    try {
                        JSONObject jsonResponse = new JSONObject(response);
                        boolean success = jsonResponse.getBoolean("success");
                        if(success){
                            Intent intent = new Intent(getActivity(), BlankFragment1.class);
                            BlankFragment2.this.startActivity(intent);
                        }
                        else {
                            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); //create an error message
                            builder.setMessage("Register Failed")
                                    .setNegativeButton("Retry",null) //click retry to retry registration
                                    .create()
                                    .show();
                        }

                    } catch (JSONException e) {
                        e.printStackTrace();
                    }


                }
            };
            RegisterRequest registerRequest = new RegisterRequest(name, surname,age,username,password,email,phone,responseListener);
            RequestQueue queue = Volley.newRequestQueue(getActivity());
            queue.add(registerRequest);
        }
    });
    return view;
}
</code></pre>

<p>Any Help?</p>