android.app.SuperNotCalledException: Activity did not call through to super.onCreate()

后端 未结 1 1585
失恋的感觉
失恋的感觉 2021-01-13 17:26

Here is my Android Media player code. I don\'t know what I am missing in this code, when I run with breakpoint at line MediaPlayer mp = new MediaPlayer()<

相关标签:
1条回答
  • 2021-01-13 18:04

    You didn't call the Activity's onCreate() method, i.e the super class' one. Add the call to MainActivity's onCreate() method:

    public class MainActivity extends Activity {
    
        private MediaPlayer mp;    
        private static final String MAIN_TAG ="ERROR";
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState); // this line is missing
    
        // your code below ...
    
    0 讨论(0)
提交回复
热议问题