App is force closing when a button is clicked inside a fragment : I just started converting my activities to fragments,, just finished a activity and found out that when I click on button in that activity the app is force closing!!!

This is my activity class: Attendence

    package wonderkids.wonderkids;
    
    import android.content.Intent;
    import android.net.Uri;
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    
    
    
    import static wonderkids.wonderkids.R.layout.exam;
    
    public class Attendence extends AppCompatActivity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(exam);
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    
        }
    
        @Override
        public boolean onSupportNavigateUp(){
            finish();
            return true;
        }
        Intent browserIntent;
    
        public void one(View v) {
            Button clickedButton = (Button) v;
            switch (clickedButton.getId()) {
                case R.id.button:
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;
                case R.id.button2:{
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;}
                case R.id.button3:{
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;}
                case R.id.button4:{
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;}
                case R.id.button5:{
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;}
                case R.id.button6:{
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;}
                case R.id.button7:{
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;}
                case R.id.button8:{
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;}
                case R.id.button9:{
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;}
                case R.id.button10:{
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;}
                /*case R.id.fab:{
                    Intent i = new Intent(Exams.this, Home.class);
                    startActivity(i);
                    break;
                }*/
            }
            startActivity(browserIntent);
        }
    }

This is the fragment which should replace Attendence
Attendance.java

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

    package wonderkids.wonderkids;


    import android.content.Intent;
    import android.net.Uri;
    import android.os.Bundle;
    import android.support.v4.app.Fragment;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.Button;

    import static wonderkids.wonderkids.R.layout.exam;


    /**
     * A simple {@link Fragment} subclass.
     */
    public class Attendance extends Fragment {


        public Attendance() {
            // Required empty public constructor
        }


        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {

            return inflater.inflate(R.layout.exam, container,false);
        }
        Intent browserIntent;

        public void one(View v) {
            Button clickedButton = (Button) v;
            switch (clickedButton.getId()) {
                case R.id.button:
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;
                case R.id.button2:{
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;}
                case R.id.button3:{
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;}
                case R.id.button4:{
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;}
                case R.id.button5:{
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;}
                case R.id.button6:{
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;}
                case R.id.button7:{
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;}
                case R.id.button8:{
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;}
                case R.id.button9:{
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;}
                case R.id.button10:{
                    browserIntent=new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
                    break;}

            }
            startActivity(browserIntent);
        }
    }


<!-- end snippet -->



This is the main class which switches fragments:
Check onNavigationItemSelected...

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

    package wonderkids.wonderkids;

    import android.content.Intent;
    import android.net.Uri;
    import android.os.Bundle;
    import android.support.design.widget.NavigationView;
    import android.support.v4.app.Fragment;
    import android.support.v4.app.FragmentManager;
    import android.support.v4.app.FragmentTransaction;
    import android.support.v4.view.GravityCompat;
    import android.support.v4.widget.DrawerLayout;
    import android.support.v7.app.ActionBarDrawerToggle;
    import android.support.v7.app.AppCompatActivity;
    import android.support.v7.widget.Toolbar;
    import android.util.Log;
    import android.view.Menu;
    import android.view.MenuItem;
    import android.view.View;

    public class Home extends AppCompatActivity
            implements NavigationView.OnNavigationItemSelectedListener {
        private static final String LOG_TAG =
                Home.class.getSimpleName();
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

            setContentView(R.layout.start);
            Log.d(LOG_TAG,"In Create");
            Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
            setSupportActionBar(toolbar);



            DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
            ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                    this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
            drawer.setDrawerListener(toggle);
            toggle.syncState();

            NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
            navigationView.setNavigationItemSelectedListener(this);
            Log.d(LOG_TAG,"In Create");
        }

        public void gall1(View view){
            Intent myIntent = new Intent(view.getContext(), Gallery.class);
            startActivityForResult(myIntent, 0);
        }

        public void hw1(View view){
            Intent myIntent = new Intent(view.getContext(), Hworks.class);
            startActivityForResult(myIntent, 0);
        }
        public void con1(View view){
            Intent myIntent = new Intent(view.getContext(), Contact.class);
            startActivityForResult(myIntent, 0);
        }

        public void res1(View view){
            Intent myIntent = new Intent(view.getContext(), Results.class);
            startActivityForResult(myIntent, 0);
        }

        public void sta1(View view){
            Intent myIntent = new Intent(view.getContext(), Staff.class);
            startActivityForResult(myIntent, 0);
        }

        public void bus1(View view){
            Intent browserIntent=new Intent(Intent.ACTION_VIEW,Uri.parse("https://www.google.com"));
            startActivity(browserIntent);
        }

        public void exa1(View view){
            Intent myIntent = new Intent(view.getContext(), Exams.class);
            startActivityForResult(myIntent, 0);
        }

        public void att1(View view){
            Intent myIntent = new Intent(view.getContext(), Attendence.class);
            startActivityForResult(myIntent, 0);
        }

        @Override
        public void onBackPressed() {
            DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
            if (drawer.isDrawerOpen(GravityCompat.START)) {
                drawer.closeDrawer(GravityCompat.START);
            } else {
                super.onBackPressed();
            }
        }

        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            getMenuInflater().inflate(R.menu.home, menu);
            return true;
        }

        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            // Handle action bar item clicks here. The action bar will
            // automatically handle clicks on the Home/Up button, so long
            // as you specify a parent activity in AndroidManifest.xml.
            int id = item.getItemId();

            //noinspection SimplifiableIfStatement
            if (id == R.id.action_settings) {
                return true;
            }
            else if(id==R.id.action_exit) {
                finish();
                return true;
            }

            return super.onOptionsItemSelected(item);
        }

        @SuppressWarnings("StatementWithEmptyBody")
        @Override
        public boolean onNavigationItemSelected(MenuItem item) {
            // Handle navigation view item clicks here.
            int id = item.getItemId();
            FragmentManager manager = getSupportFragmentManager();
            FragmentTransaction transaction = manager.beginTransaction();
            Fragment fragment = new Fragment();
            if (id == R.id.nav_home) {
                Intent i = new Intent(Home.this, Home.class);
                startActivity(i);
            } else if (id == R.id.nav_gal1ery) {
                Intent i = new Intent(Home.this, Gallery.class);
                startActivity(i);
            } else if (id == R.id.nav_exams) {
                Intent i = new Intent(Home.this, Exams.class);
                startActivity(i);
            } else if (id == R.id.nav_attendence) {
                fragment = new Attendance();

            } else if (id == R.id.nav_results) {
                Intent i = new Intent(Home.this, Results.class);
                startActivity(i);
            } else if (id == R.id.nav_share) {
                try {
                    Intent i = new Intent(Intent.ACTION_SEND);
                    i.setType("text/plain");
                    i.putExtra(Intent.EXTRA_SUBJECT, "Wonder Kids");
                    String sAux = "\nTry This\n";
                    sAux = sAux + "https://play.google.com/store/apps/details?id=Orion.Soft \n\n";
                    i.putExtra(Intent.EXTRA_TEXT, sAux);
                    startActivity(Intent.createChooser(i, "choose one"));
                } catch(Exception e) {
                    //e.toString();
                }
            } else if (id == R.id.nav_cotact) {
                Intent i = new Intent(Home.this, Contact.class);
                startActivity(i);
            } else if (id == R.id.nav_newsletter) {
                Intent browserIntent=new Intent(Intent.ACTION_VIEW,Uri.parse("https://www.google.com"));
                startActivity(browserIntent);
            }
            transaction.replace(R.id.fragment_container, fragment);
            transaction.commit();

            DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
            drawer.closeDrawer(GravityCompat.START);
            return true;


        }
    }


<!-- end snippet -->

And this is the xml file for Attendance(fragment) which I also used for Attendence(activity) and many other... (buttons work fine when accessing exam.xml from another activity)

exam.xml

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->

    <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/back"
        tools:context="wonderkids.wonderkids.Attendance">
        <android.support.constraint.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">


        <Button
            android:id="@+id/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="27dp"
            android:layout_marginStart="27dp"
            android:onClick="one"
            android:text="1st class"
            app:layout_constraintBaseline_toBaselineOf="@+id/button2"
            app:layout_constraintLeft_toLeftOf="parent"
            tools:layout_constraintBaseline_creator="1"
            tools:layout_constraintLeft_creator="1" />

        <Button
            android:id="@+id/button3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="26dp"
            android:onClick="one"
            android:text="3rd class"
            app:layout_constraintBaseline_toBaselineOf="@+id/button2"
            app:layout_constraintRight_toRightOf="parent"
            tools:layout_constraintBaseline_creator="1"
            tools:layout_constraintRight_creator="1" />

        <Button
            android:id="@+id/button4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="27dp"
            android:onClick="one"
            android:text="4th class"
            app:layout_constraintBaseline_toBaselineOf="@+id/button6"
            app:layout_constraintLeft_toLeftOf="parent"
            tools:layout_constraintBaseline_creator="1"
            tools:layout_constraintLeft_creator="1" />

        <Button
            android:id="@+id/button5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="24dp"
            android:onClick="one"
            android:text="6th class"
            app:layout_constraintBaseline_toBaselineOf="@+id/button6"
            app:layout_constraintRight_toRightOf="parent"
            tools:layout_constraintBaseline_creator="1"
            tools:layout_constraintRight_creator="1" />

        <Button
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="55dp"
            android:onClick="one"
            android:text="2nd class"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            tools:layout_constraintLeft_creator="1"
            tools:layout_constraintRight_creator="1"
            tools:layout_constraintTop_creator="1" />

        <Button
            android:id="@+id/button6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="44dp"
            android:onClick="one"
            android:text="5th class"
            app:layout_constraintLeft_toLeftOf="@+id/button2"
            app:layout_constraintRight_toRightOf="@+id/button2"
            app:layout_constraintTop_toBottomOf="@+id/button2"
            tools:layout_constraintLeft_creator="1"
            tools:layout_constraintRight_creator="1"
            tools:layout_constraintTop_creator="1" />

        <Button
            android:id="@+id/button7"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="44dp"
            android:onClick="one"
            android:text="7th class"
            app:layout_constraintLeft_toLeftOf="@+id/button4"
            app:layout_constraintRight_toRightOf="@+id/button4"
            app:layout_constraintTop_toBottomOf="@+id/button4"
            tools:layout_constraintLeft_creator="1"
            tools:layout_constraintRight_creator="1"
            tools:layout_constraintTop_creator="1" />

        <Button
            android:id="@+id/button8"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="44dp"
            android:onClick="one"
            android:text="8th class"
            app:layout_constraintLeft_toLeftOf="@+id/button6"
            app:layout_constraintRight_toRightOf="@+id/button6"
            app:layout_constraintTop_toBottomOf="@+id/button6"
            tools:layout_constraintLeft_creator="1"
            tools:layout_constraintRight_creator="1"
            tools:layout_constraintTop_creator="1" />

        <Button
            android:id="@+id/button9"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="44dp"
            android:onClick="one"
            android:text="9th class"
            app:layout_constraintLeft_toLeftOf="@+id/button5"
            app:layout_constraintRight_toRightOf="@+id/button5"
            app:layout_constraintTop_toBottomOf="@+id/button5"
            tools:layout_constraintLeft_creator="1"
            tools:layout_constraintRight_creator="1"
            tools:layout_constraintTop_creator="1" />

        <Button
            android:id="@+id/button10"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="38dp"
            android:onClick="one"
            android:text="10th class"
            app:layout_constraintLeft_toLeftOf="@+id/button8"
            app:layout_constraintTop_toBottomOf="@+id/button8"
            tools:layout_constraintLeft_creator="1"
            tools:layout_constraintTop_creator="1" />


        </android.support.constraint.ConstraintLayout>
    </FrameLayout>

<!-- end snippet -->


And if needed this is the empty container:

startac.xml

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:layout_width="match_parent"
        android:layout_height="match_parent">



        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/fragment_container"
            android:orientation="vertical">

        </LinearLayout>
    </LinearLayout>

<!-- end snippet -->


And when I see Attendance(fragment) near 
import static wonderkids.wonderkids.R.layout.exam;
and
one in     public void one(View v) {
I get unused import statement and method one is never used!!
If u need any extra code or didn't understand my question please comment!!