How to improve fragment loading speed?

后端 未结 5 770
清歌不尽
清歌不尽 2020-12-04 14:38

Performance Enhancement:

Previously I saved ALL images in drawable folder, this might be the reason why the map first l

5条回答
  •  佛祖请我去吃肉
    2020-12-04 15:20

    [EDITED]

    The getMap() and setUpMap() methods are probably very slow. Their processing should be done in an AsyncTask so that onCreateView() can return quickly every time.

    More info: onCreateView() is called on the UI thread, so any slow processing that it does will freeze the UI. Your AsyncTask should do all the slow processing in its doInBackground() method, and then update the UI in its onPostExecute() method. See the AsyncTask JavaDoc for more details.

提交回复
热议问题