How do handle onBackPressed() in Fragment?
<p>This is my class name</p>

<pre><code>public class PrimaryFragment extends Fragment implements OnRestartRequest {

    @Override
    public void onBackPressed() {
        if (mCardStackLayout.isCardSelected()) {
            mCardStackLayout.restoreCards();
        } else {
            super.onBackPressed();
        }
    }
</code></pre>

<p>Error on this line: <code>super.onBackPressed();</code></p>

<p>I don't know what's the problem in fragment class's on back pressed button.</p>