Parcelable encountered IOException writing serializable object getactivity()

前端 未结 12 1874
故里飘歌
故里飘歌 2020-11-29 22:15

so I am getting this in logcat:

java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.resources.student_list         


        
12条回答
  •  时光说笑
    2020-11-29 22:35

    In my case I had to implement MainActivity as Serializable too. Cause I needed to start a service from my MainActivity :

    public class MainActivity extends AppCompatActivity implements Serializable {
        ...
        musicCover = new MusicCover(); // A Serializable Object
        ...
        sIntent = new Intent(MainActivity.this, MusicPlayerService.class);
        sIntent.setAction(MusicPlayerService.ACTION_INITIALIZE_COVER);
        sIntent.putExtra(MusicPlayerService.EXTRA_COVER, musicCover);
        startService(sIntent);
    }
    

提交回复
热议问题