Fragment open on click event of button : Hey Guys I know its very silly question but i'm facing it from last few days

This is my click event

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
               Intent i = new Intent(MainActivity.this,NewCase.class);
               startActivity(i);

                Fragment newCase = new NewCase();
                FragmentTransaction transaction = getFragmentManager().beginTransaction();
                transaction.replace(, newCase ); // give your fragment container id in first parameter
                transaction.addToBackStack(null);  // if written, this transaction will be added to backstack
                transaction.commit();

            }
        });

And this is my fragment class

    public class NewCase extends Fragment {}

Now let me know how to open fragment class with xml view in android Thanks in advance