android - What are arguments in favor of fragments vs. view flipping in this context? -


i amateur hobbyist has been working on trivia game past several weeks. first version of game works user perspective, code super messy , i'm writing second version of game scratch. i'm making significant change way game moves between pages, converting view flipping use of fragments. based on research far, think new design more in line best practices, not sure understand how arguments , against use of fragments apply game.

design #1. old design relied on 3 activity files: mainactivity served splash page allowed users select appropriate difficulty level, gameactivity delivered both trivia questions and answers of viewflipper, , scoreactivity reported user's score while making sure highestscoreachieved recorded in preferences.

design #2. new design rely on single activity file single fragment container , 4 fragments. startfragment splash page, questionfragment question page, answerfragment answer page, , scorefragment reports final game score.

i think fragment-based design #2 more in line best practices. big nerd ranch book on android programming preaches a.u.f. ("always use fragments") on grounds more difficult go , add fragments after fact, there must other arguments in favor of fragments well.

i have researched on stackoverflow, , of examples involve different situations (e.g. split views , reusable views).

thus, question: arguments in favor of fragments opposed view flipping in context of game described above? there arguments against fragment-based design silly little trivia game?

aaron

simply put, fragments mini activitys allow break app logic smaller organized units specific actions. allows break down apps functionality more focused, reusable components can better adapt different devices.

this better alternative having large activitys many things, become bloated , hard maintain, , difficult make work varying screen sizes , orientations (think landscape / tablets).

fragments recommended because offer flexibility , code organization front, application evolves , add supports more device configurations , features, easier maintain , more flexible. have written , in depth blog using fragments support device in orientation, covers reasons fragments added along open sourced example project.


what arguments in favor of fragments opposed view flipping in context of game described above?

view flipping require of logic , memory used activity, when of active @ time, while fragments can loaded @ appropriate time.

are there arguments against fragment-based design silly little trivia game?

you argue fragments add architectural overhead simple. but, features , code increases, fragments , design save lot of headache, , perform better. if intend on releasing game public, suggest use fragments (where necessary).


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -