-3
 public void onStop() {
        information=Option.getText().toString();
        if (!information.equals("")) {
            //Toast.makeText(activity, "All unsubmitted information will be discarded", Toast.LENGTH_SHORT).show();
            LayoutInflater inflater = null;
            inflater = ( LayoutInflater )activity.
                    getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View v = inflater.inflate(R.layout.layout_back_press,null);
            AlertDialog.Builder builder = new AlertDialog.Builder(v.getContext());
            builder.setView(v);
            dialog = builder.create();
            dialog.show();
            TextView cancel = (TextView) v.findViewById(R.id.txt_Cancel);
            cancel.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    dialog.cancel();
                    //Toast.makeText(activity, "Feedback not sent", Toast.LENGTH_SHORT).show();
                }
            });
            TextView send = (TextView) v.findViewById(R.id.txt_Send);
            send.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    dialog.cancel();
                    FeedbackConcernsFragment.super.onStop();
                   // FeedbackConcernsFragment.onStop();
                    //Toast.makeText(activity, "Feedback sent", Toast.LENGTH_SHORT).show();
                }
            });

        }else {
            super.onStop();
        }

    }

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.guideme, PID: 23746 android.util.SuperNotCalledException: Fragment FeedbackConcernsFragment{22c43a48 #2 id=0x7f110159} did not call through to super.onStop() at android.app.Fragment.performStop(Fragment.java:1873) at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:941) at android.app.FragmentManagerImpl.removeFragment(FragmentManager.java:1167) at android.app.BackStackRecord.popFromBackStack(BackStackRecord.java:718) at android.app.FragmentManagerImpl.popBackStackState(FragmentManager.java:1496) at android.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:495) at android.app.Activity.onBackPressed(Activity.java:2288) at android.support.v4.app.FragmentActivity.onBackPressed(FragmentActivity.java:179) at com.guideme.activities.MainActivity.onBackPressed(MainActivity.java:352) at android.app.Activity.onKeyUp(Activity.java:2266) at android.view.KeyEvent.dispatch(KeyEvent.java:2724) at android.app.Activity.dispatchKeyEvent(Activity.java:2496) at android.support.v7.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:541) at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:59) at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:319)

alex
  • 8,904
  • 6
  • 49
  • 75
Jarin Rocks
  • 975
  • 10
  • 17
  • 1
    Possible duplicate of [android.app.SuperNotCalledException: Activity did not call through to super.onStop()](https://stackoverflow.com/questions/9397020/android-app-supernotcalledexception-activity-did-not-call-through-to-super-onst) – Torben Aug 25 '17 at 08:39

3 Answers3

1

The crashlog actually tells you the problem:

android.util.SuperNotCalledException

The main lifecycle functions must always call their super function. So just add

super.onStop();

as the first line in the method and the code will work :)

PS: and don't forget to remove the super call in the else branch, since that is not needed anymore.

Bmuig
  • 1,059
  • 7
  • 12
1

You should call super in onStop.

@Override
public void onStop() {
    super.onStop();
    // Your code here
} 
Samuel Peter
  • 4,136
  • 2
  • 34
  • 42
0

Please do a bit research before asking the question, This question already has a answer over here: android.app.SuperNotCalledException: Activity did not call through to super.onStop()

suv
  • 171
  • 3
  • 15
  • Please get yourself acquainted with Stackoverlow. This is should clearly be posted as a comment, or even better, flagged as a duplicate. I understand that you don't have the reputation to do so, but please do not post 'answers' like these – 0xDEADC0DE Aug 25 '17 at 09:15