android: how do i preserve the data in my arrayadapter/listview when change orientation?

后端 未结 6 637
醉梦人生
醉梦人生 2020-12-16 08:14

as above, is it done automatically? My list was empty once the orientation chMYanges? and nope, i need the orientation change =)

My adapter

public cl         


        
6条回答
  •  太阳男子
    2020-12-16 08:57

    If you have data in memory that needs to stick around during an orientation change, you need to do something to arrange that. The best solution is to implement onSaveInstanceState() and use it to store your data, because that gets used not only for orientation changes, but other situations as well (e.g., your activity is on the current stack, but it needs to get kicked out of RAM to free up space for things later in the stack).

提交回复
热议问题