onSaveInstanceState not working

前端 未结 3 983
轮回少年
轮回少年 2021-01-07 09:16

I know this question has already been asked a lot, but I don\'t get why onSaveInstanceState isn\'t working for me. It\'s probably something stupid, but I hope some of you ca

3条回答
  •  一向
    一向 (楼主)
    2021-01-07 09:27

    You're extracting the saved values in the "onRestoreInstanceState()" callback, but you don't actually do anything with them.

    ArrayList ToDo = savedInstanceState.getStringArrayList("MyArrayList");
    

    You need to wrap these values in an adapter and assign it to the list, like you do it in the end of onCreate().

提交回复
热议问题