java - Recycling an inflated view on Android -


i have complicated viewgroup fragment created every , then. 1 instance fragment can shown @ time.

i wondering if possible somehow store inflated view , reuse when fragment created again.

obviously view properties have changed, @ least view not need inflated again.

i tried store view element static element , check if exists, , if does, use it.

however, believe view element has fragment specific properties , if use fragment has different reference id, fail - well..it failed.

has tried cache inflated views , reuse them?

it seems risky reuse views across different fragments (although it's safe reuse them in same fragment).

what if context changes, example if activity gets recreated? guess have hope no views call getcontext() , try use activity context because invalid , may lead unexpected results.

what can sure optimized layout (like avoiding nested weights , relativelayouts when possible) or use custom views simplify layout.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -