I am calling Recycler Adapter from Fragment not from acvity
.
When I click on Item in Recyclerview
, I want to navigate to another Fragment
.
So for that I have written onClickListner()
in Adapter
.
private View.OnClickListener onClickListener(final int position){
return new View.OnClickListener(){
@Override
public void onClick(View v) {
try{
activityType = context.getActivityFragmentTag(EmpConstants.WorkType.Entry);
fragment = new Entry_Fragment();
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.fragment_container, fragment, activityType)
.commit();
}catch (Exception e){
Log.e("eEmp/StnFailAdapter","Excp due to"+e.toString());
}
}
};
}
But it is showing error at getSupportFragmentManager();