This is my class name
public class PrimaryFragment extends Fragment implements OnRestartRequest {
@Override
public void onBackPressed() {
if (mCardStackLayout.isCardSelected()) {
mCardStackLayout.restoreCards();
} else {
super.onBackPressed();
}
}
Error on this line: super.onBackPressed();
I don't know what's the problem in fragment class's on back pressed button.
There is no onBackPressed()
method in Fragment
. You can do something like calling getActivity().onBackPressed()
from your Fragment
.