TIL
240417 TIL - Fragment Lifecycle, ListView์ RecyclerView ๋น๊ต, ์ง๋ ฌํ
Fragment Lifecycle Fragment View๋ Fragment์ ์๋ช ์ฃผ๊ธฐ๋ก๋ถํฐ ๋ ๋ฆฝ์ ์ธ ์๋ช ์ฃผ๊ธฐ๋ฅผ ๊ฐ์ง๋๋ค. Fragment View์ ์๋ช ์ฃผ๊ธฐ๋ LiveData observing๊ณผ ๊ฐ์ด ํ๋ฉด์ ํ์๋์ด์ผ๋ง ์๋ฏธ ์๋ ํ์๋ค์ ๋ค๋ฃจ๋๋ฐ ์ ์ฉํฉ๋๋ค. Fragment์ ์๋ช ์ฃผ๊ธฐ๋ Fragment Manager์ ์ํด ๊ด๋ฆฌ๋๊ณ ์ค์ ๋ฉ๋๋ค. FragmentManager๋ Fragment์ ์๋ช ์ฃผ๊ธฐ์ ๋๋ถ์ด Fragment๋ฅผ Host Activity์ attachํ๊ณ , detach ํ๋ ํ์๋ฅผ ์ํํฉ๋๋ค. Fragment๋ onAttach, onDetach ์ฝ๋ฐฑ ๋ฉ์๋๋ฅผ ํตํด ์ด ์ด๋ฒคํธ๊ฐ ๋ฐ์ํ์ ๋์ ๋์ ์ฒ๋ฆฌ๋ฅผ ์ง์ํฉ๋๋ค. ๋ฐ๋ผ์ XML์์ Fragment๋ฅผ ์ง์ ์ฌ์ฉํด์๋ ์ ๋๊ณ , Fragm..