Fragment
FragmentTransaction - setCustomAnimations()
fragment ๊ฐ add ํน์ replace ๋ ๋ animation ์ ์ค์ ํ ์ ์์.
transaction ํ๋ฆ ๋ด์์ setCustomAnimations ํธ์ถ์ add, replace ๋ณด๋ค ๋ค์์ ํ ๊ฒฝ์ฐ animation ์ด ์ ์ฉ๋์ง ์์
addToBackStack() ์ผ๋ก fragment ๋ฅผ backStack ์ ๋ฃ๋ ๊ฒฝ์ฐ์ ๋ฃ์ง ์๋ ๊ฒฝ์ฐ ์ฌ์ฉ๋๋ ๋ฉ์๊ฐ ๋ค๋ฆ
setCustomAnimations(int i1, int i2) // addToBackStack X
setCustomAnimations(int i1, int i2, int i3, int i4) // addToBackStack O
FragmentTransaction - commitAllowingStateLoss()
commitAllowingStateLoss()
์ผ๋ฐ์ ์ผ๋ก activity ์ onSaveInstance() ๊ฐ ํธ์ถ๋ ์ดํ commit ์ ํธ์ถ ํ ๊ฒฝ์ฐ exception ๋ฐ์ํจ.
ํด๋น ๋ฉ์๋๋ฅผ ์ฐ๋ฉด activity ์ onSaveInstance ํธ์ถ ์ดํ ํด๋น ๋ฉ์๋๊ฐ ๋ถ๋ ค๋, exception ์ด throw ๋์ง ์๊ณ transaction ๋ด์ฉ์ด commit ๋จ. ๋ค๋ง, saveInstance ์ ์ ์ฅ๋์ง ์์ ์ ์๋ ์ ์ ์ธ์งํ๊ณ ์ฌ์ฉ ํ ๊ฒ
ref : https://medium.com/inloopx/demystifying-androids-commitallowingstateloss-cb9011a544cc
Last updated
Was this helpful?