Error : android.app.SuperNotCalledException

后端 未结 5 1617
野的像风
野的像风 2021-02-08 05:10

i am new user of android and i had make one android database connection and create table application but at run time it will generate an error.
an error is hear :

相关标签:
5条回答
  • 2021-02-08 05:52
     @Override     
       public void onDestroy() {   
      super.onDestroy()
         eventsData.close();     
       }   
    
    0 讨论(0)
  • 2021-02-08 05:55

    I found a solution for my situation, where I wanted to have the tab bars animate away before allowing the onDestroy() to continue. SuperNotCalledException will be thrown only if the inaccessible mCalled field is not set by super.onDestroy(), but digging in the source revealed that the public method super.onDestroyView() ONLY sets this field -- so I did the following to allow actual super.onDestroy() to be called in an endAction (am using RetroLambda) :

    @Override
    public void onDestroy() {
        super.onDestroyView();  //Calling this public method will prevent the android.support.v4.app.SuperNotCalledException when we don't immediately call the super.onDestroy - since it is in an endAction
        removeHeaderView(super::onDestroy);
    }
    

    Hope this helps someone else!

    0 讨论(0)
  • 2021-02-08 05:59
    public void onDestroy() {   
        super.onDestroy();
        eventsData.close();     
    }
    

    This is to be called because, Activity class in android does some cleanup by itself. When base class functions are overridden by the derived class that is the activity as done in case of onDestroy(), the base class function needs to be called explicitly to perform the expected operation.

    0 讨论(0)
  • 2021-02-08 06:03

    I added this line and everything worked fine:

    super.onCreate(savedInstanceState);
    

    Added it to the first line in OnCreate() method.

    0 讨论(0)
  • 2021-02-08 06:05

    Add this code for onDestroy() method.

    super.onDestroy();
    

    It worked for me.

    0 讨论(0)
提交回复
热议问题