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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With