How to avoid recreating view on onCreate on Android?

前端 未结 11 1763
执笔经年
执笔经年 2021-01-17 22:18

I have a FragmentActivity that shows a contacts list.

Here is my onCreate method:

@Override
protected void onCreate(Bundle          


        
11条回答
  •  爱一瞬间的悲伤
    2021-01-17 22:47

    In your on create method just clear your list.Because every time it will go to on create method and make list clear(which) is your previous data loading.

    OR

    check your list if(list.size==null) then call your API otherwise in else block (list.setAdapter).

    hope it will work.

提交回复
热议问题