unable to start new activity involving firebase : I am building an app that has a charity and restuarant .they registers themselves and then proceed.using firebase for database handling.
when i register charity register charity should open but it shows error.
logcat and register charity file attached.Pls help asap.
thanks in advance.

#activity register charity #

    

    package com.example.aayu.myapplication;

    import android.content.Intent;
    import android.os.Bundle;
    import android.support.v7.app.AppCompatActivity;
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.Toast;
    import com.google.firebase.database.DatabaseReference;
    import com.google.firebase.database.FirebaseDatabase;

    /**
     * Created by AAYU on 30-May-17.
     */

    public class regc extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.reg_c);




        final DatabaseReference rootref = FirebaseDatabase.getInstance()
                .getReferenceFromUrl("https://myapplication-6e0b9.firebaseio.com/charity");

        final EditText mname = (EditText) findViewById(R.id.cname);
        final EditText madd = (EditText) findViewById(R.id.cadd);
        final EditText mcity = (EditText) findViewById(R.id.ccity);
        final EditText mstate = (EditText) findViewById(R.id.cstate);
        final EditText mpin = (EditText) findViewById(R.id.cpin);



        final Button mnext= (Button) findViewById(R.id.cnext);

          mnext.setOnClickListener(new View.OnClickListener(){

              @Override
              public void onClick(View view){
                  String name = mname.getText().toString();
                  String add = madd.getText().toString();
                  String city = mcity.getText().toString();
                  String state = mstate.getText().toString();
                  String pin = mpin.getText().toString();

                  DatabaseReference childref = rootref.child("Charity Name");
                  childref.setValue(name);
                  childref = rootref.child("Address");
                  childref.setValue(add);
                  childref = rootref.child("City");
                  childref.setValue(city);
                  childref = rootref.child("State");
                  childref.setValue(state);
                  childref = rootref.child("Pincode");
                  childref.setValue(pin);
              }
          });



        //setContentView(R.layout.reg2_c);

        final EditText memail = (EditText) findViewById(R.id.cemail);
        final EditText mph = (EditText) findViewById(R.id.cph);
        final EditText muname = (EditText) findViewById(R.id.cuname);
        final EditText  mpwd = (EditText) findViewById(R.id.cpwd);


        final Button mreg=(Button) findViewById(R.id.creg);

        mreg.setOnClickListener(new View.OnClickListener(){

            @Override
            public void onClick(View view) {

                String email = memail.getText().toString();
                String ph = mph.getText().toString();
                String uname = muname.getText().toString();
                String pwd = mpwd.getText().toString();

                DatabaseReference childref = rootref.child("Email Id");
                childref.setValue(email);
                childref = rootref.child("Phone No");
                childref.setValue(ph);
                childref = rootref.child("Username");
                childref.setValue(uname);
                childref = rootref.child("Password");
                childref.setValue(pwd);

                Toast.makeText(view.getContext(), "Registration done successfully", Toast.LENGTH_SHORT).show();
            }
            });


           // Intent loginc = new Intent(this, loginc.class);
           // startActivity(loginc);


    }
}


#logcat#

    

    W/GooglePlayServicesUtil: Google Play services out of date.  Requires 11011000 but found 9877470
    V/FA: Activity paused, time: 32230643
    V/FA: Processing queued up service tasks: 2
    E/FA: Failed to send current screen to service
    E/FA: Discarding data. Failed to send event to service
    D/AndroidRuntime: Shutting down VM
    E/UncaughtException: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.aayu.myapplication/com.example.aayu.myapplication.regc}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
                         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
                         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
                         at android.app.ActivityThread.-wrap12(ActivityThread.java)
                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
                         at android.os.Handler.dispatchMessage(Handler.java:102)
                         at android.os.Looper.loop(Looper.java:154)
                         at android.app.ActivityThread.main(ActivityThread.java:6077)
                         at java.lang.reflect.Method.invoke(Native Method)
                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
                      Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
                         at com.example.aayu.myapplication.regc.onCreate(regc.java:76)
                         at android.app.Activity.performCreate(Activity.java:6662)
                         at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
                         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
                         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707) 
                         at android.app.ActivityThread.-wrap12(ActivityThread.java) 
                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460) 
                         at android.os.Handler.dispatchMessage(Handler.java:102) 
                         at android.os.Looper.loop(Looper.java:154) 
                         at android.app.ActivityThread.main(ActivityThread.java:6077) 
                         at java.lang.reflect.Method.invoke(Native Method) 
                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) 
                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) 
    E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.example.aayu.myapplication, PID: 9023
                  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.aayu.myapplication/com.example.aayu.myapplication.regc}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
                      at android.app.ActivityThread.-wrap12(ActivityThread.java)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:154)
                      at android.app.ActivityThread.main(ActivityThread.java:6077)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
                   Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
                      at com.example.aayu.myapplication.regc.onCreate(regc.java:76)
                      at android.app.Activity.performCreate(Activity.java:6662)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707) 
                      at android.app.ActivityThread.-wrap12(ActivityThread.java) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460) 
                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                      at android.os.Looper.loop(Looper.java:154) 
                      at android.app.ActivityThread.main(ActivityThread.java:6077) 
                      at java.lang.reflect.Method.invoke(Native Method) 
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) 
    D/NetworkSecurityConfig: No Network Security Config specified, using platform default
    Application terminated.


