Q:

How can i switch this option menu on fragment to activity

I want this option menu on my add apartment fragment to intent here at the add apartment class. while running this code my app gets crashed, I might have missed something could someone please help me, what should I do?? 
LandlordAddApartment.java
public class LandlordAddApartment extends Fragment {

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);

}
@Nullable
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {

    inflater.inflate(R.menu.add_apartment, menu);
    super.onCreateOptionsMenu(menu, inflater);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.landlord_add_apartment) {

            LanlordMapFragment mapFragment = new LanlordMapFragment();
            FragmentManager manager = getFragmentManager();
            manager.beginTransaction().replace(R.id.landlord_apartment, mapFragment, mapFragment.getTag()).commit();

            return true;

    }

    return super.onOptionsItemSelected(item);
}

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    getActivity().setTitle("Manage Apartment");
}

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View v =  inflater.inflate(R.layout.landlord_add_apartment, container, false);

    return v;

A:

You can use from switching from Fragment to Activity:
startActivity(new Intent(getActivity,YourActivity.Class));

And while moving from Activity to Fragment:
YourFragment mapFragment = new YourFragment();
FragmentManager manager = getFragmentManager();
manager.beginTransaction().replace(R.id.landlord_apartment, mapFragment, mapFragment.getTag()).commit();

