Android - Create Application level fragment -


for current project, using slidinguppanel library.

the sliding panel host fragment contain application/global level information. panel in every activity in application. similar way google play music works.

my question is, best way persist sliding panel fragment throughout application? see myself going in 2 ways...

  1. storing fragment inside application class , loading @ start of every activity (somehow, not sure if possibility).
  2. storing data display in application class & loading new instance of fragment, passing in persisted data.

which 1 of these 2 ways best? 1. possible? there coding landmines these approaches?

storing fragment persist throughout application lifecycle pretty unorthodox, because fragment class should able follow it's normal lifecycle events (in case, onpause , onresume) instead of being stuck somewhere in application class.

it common practice store data , load each time display fragment. if want enable sort of cacheing or singleton pattern access data, should object fragment can access not member within fragment.

there good video google leaking views , touches briefly on pitfalls of doing similar you're proposing in bullet #1.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -