Is there any graphical representation of Android views lifecycle (a state diagram)? [closed]
Asked Answered
S

2

77

We all know about the Android Activity's life cycle and Fragment's life cycles. But is there anything equivalent for views ?

This could help, for instance, building custom views or give an in-depth look at a very common and often hidden graphic operation on Android.

Thanks in advance !

Semifluid answered 30/10, 2012 at 20:3 Comment(1)
This is not a direct answer as others have answered already, but I invite you to have a look at LogLifeCycle to understand what happens in your android apps regarding to life cycles.Semifluid
B
69

It isn't an official document, but this recently came up on Google+. The comments also have a good discussion with some detailed explanation.

Benison answered 30/10, 2012 at 20:5 Comment(6)
What about onSaveInstanceState / onRestoreInstanceState?Bambino
Further information at Android view lifecycleLockard
https://mcmap.net/q/266613/-life-cycle-of-view-android this shows Android Activity lifecycle & Android View lifecycle tested on my device (Sony Z1 Compact)Prepense
"Google+ is no longer available for consumer (personal) and brand accounts" thats why answers shouldnt be just a linkHumpy
Use my link github.com/dbof10/android-view-lifecycleSeddon
this might help medium.com/@rifqi416/…Ear
E
12

Here I created custom view that extends View. Then wrote logs in each method. Here the order of called methods:
When run debugging
setOverScrollMode
setOverScrollMode
onFinishInflate
setLayoutParams
getLayoutDirection
requestLayout
hasFocus
hasTransientState
getVisibility
getLayoutDirection
getLayoutDirection
canResolveLayoutDirection
getLayoutDirection
canResolveTextDirection
isLayoutDirectionResolved
isLayoutDirectionResolved
getLayoutDirection
getLayoutDirection
isLayoutDirectionResolved
isTextDirectionResolved
isTextAlignmentResolved
getLayoutDirection
jumpDrawablesToCurrentState
jumpDrawablesToCurrentState
jumpDrawablesToCurrentState
jumpDrawablesToCurrentState
jumpDrawablesToCurrentState
jumpDrawablesToCurrentState
getVisibility
onAttachedToWindow
jumpDrawablesToCurrentState
getBackground
isFocused
isShown
onVisibilityAggregated
refreshDrawableState
drawableStateChanged
onCreateDrawableState
isFocused
hasWindowFocus
getVisibility
onMeasure
getSuggestedMinimumWidth
getSuggestedMinimumHeight
getVisibility
getVisibility
onMeasure
getSuggestedMinimumWidth
getSuggestedMinimumHeight
getVisibility
getVisibility
layout
isOpaque
onSizeChanged
getBackground
isOpaque
getMatrix
isOpaque
isHardwareAccelerated
getZ
getElevation
getTranslationZ
onLayout
getVisibility
getAnimation
getLayerType
getLayerType
computeScroll
draw
onDraw
dispatchDraw
onDrawForeground
hasOverlappingRendering
dispatchWindowFocusChanged
onWindowFocusChanged
refreshDrawableState
drawableStateChanged
onCreateDrawableState
isFocused
hasWindowFocus

Opening activity with this view:
onScreenStateChanged
getLayoutDirection
getAnimation
getLayerType
getVisibility
getVisibility
getVisibility
layout
getVisibility
dispatchWindowFocusChanged
onWindowFocusChanged
refreshDrawableState
drawableStateChanged
onCreateDrawableState
isFocused
hasWindowFocus

Emelun answered 23/9, 2017 at 19:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.