Hi I have A RecycleView
Adapter
and A button. I want that button to start a Fragment. I can start an activity but not a fragment. I have tried this Onclick
method for my Button
@Override
public void onClick(View v) {
Bundle bundle = new Bundle();
bundle.putParcelable("event", events.get(getLayoutPosition()));
Fragment fragment = new EditEventDetailFragment();
fragment.setArguments(bundle);
fragment.getFragmentManager().beginTransaction().replace(R.id.contentMainDrawer,fragment).commit();
}
But have error invoke null object (contentMainDrawer
) is my Main activity content_layout.
Any help is much appreciate. The Fragment host recycle view is call from Mainactivity