Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 !

like image 353
Snicolas Avatar asked Oct 30 '12 20:10

Snicolas


2 Answers

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

like image 159
Raghav Sood Avatar answered Nov 04 '22 06:11

Raghav Sood


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

like image 39
Evgenii Vorobei Avatar answered Nov 04 '22 04:11

Evgenii Vorobei