Here is my code in my AddClassAdapter recylerview using firebase below on "onBindViewHolder":
holder.editBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
UserClasses userClasses = new UserClasses();
userClasses.openEditClassDialog();
}
});
And here is the "openEdiClassDialog" method in my main activity:
public void openEditClassDialog(){
UserClassEditDialog userClassEditDialog = new UserClassEditDialog();
userClassEditDialog.show(getSupportFragmentManager(),"user class dialog");
}
My problem is, If I clicked the edit button of an item in the recylerview adapter, this error shows in my logcat:
java.lang.IllegalStateException: FragmentManager has not been attached to a host. at androidx.fragment.app.FragmentManager.enqueueAction
At this moment, I am finding a solution to try, but I am expecting that if I clicked the edit button, a dialog will pop up.