πŸ€”
TIL
  • README
  • root
    • Android
      • TextView
      • Intent
      • RecyclerView
      • ImageView
      • Style
      • Activity
      • Databinding
      • EditText
      • RxJava
      • Fragment
    • Code
      • κ°€μž₯ λ§Žμ€ 정보λ₯Ό κ°€μ§„ 객체
    • Shell
      • script
        • 초기 μ„€μ •
        • κΈ°λ³Έ 문법
      • chmod
  • Blog
  • Github
Powered by GitBook
On this page
  • FragmentTransaction - setCustomAnimations()
  • FragmentTransaction - commitAllowingStateLoss()

Was this helpful?

  1. root
  2. Android

Fragment

PreviousRxJavaNextCode

Last updated 5 years ago

Was this helpful?

FragmentTransaction - setCustomAnimations()

  1. fragment κ°€ add ν˜Ήμ€ replace 될 λ•Œ animation 을 μ„€μ •ν•  수 있음.

  2. transaction 흐름 λ‚΄μ—μ„œ setCustomAnimations ν˜ΈμΆœμ„ add, replace 보닀 λ’€μ—μ„œ ν•  경우 animation 이 μ μš©λ˜μ§€ μ•ŠμŒ

  3. addToBackStack() 으둜 fragment λ₯Ό backStack 에 λ„£λŠ” κ²½μš°μ™€ λ„£μ§€ μ•ŠλŠ” 경우 μ‚¬μš©λ˜λŠ” λ©”μ†Œκ°€ 닀름

setCustomAnimations(int i1, int i2) // addToBackStack X
setCustomAnimations(int i1, int i2, int i3, int i4) // addToBackStack O

FragmentTransaction - commitAllowingStateLoss()

일반적으둜 activity 의 onSaveInstance() κ°€ 호좜된 이후 commit 을 호좜 ν•  경우 exception λ°œμƒν•¨.

ν•΄λ‹Ή λ©”μ†Œλ“œλ₯Ό μ“°λ©΄ activity 의 onSaveInstance 호좜 이후 ν•΄λ‹Ή λ©”μ†Œλ“œκ°€ λΆˆλ €λ„, exception 이 throw λ˜μ§€ μ•Šκ³  transaction λ‚΄μš©μ΄ commit 됨. λ‹€λ§Œ, saveInstance 에 μ €μž₯λ˜μ§€ μ•Šμ„ 수 μžˆλŠ” 점을 μΈμ§€ν•˜κ³  μ‚¬μš© ν•  것

ref :

https://medium.com/inloopx/demystifying-androids-commitallowingstateloss-cb9011a544cc