Saturday, 15 January 2011

android - Should I use several activities for an app with several screens? -



android - Should I use several activities for an app with several screens? -

i'm new android , i'm building simple application start with. consists of client 3 screens. in first screen user prompted ip connect server (i utilize edittext , button). if connection established, info retrieved server , client show info on blank screen (i utilize textview). sec screen. then, user inquire server detailed info info has been retrieved server, 3rd screen (i utilize textview again).

the problem don't know what's best way go it. have 1 activity , 1 xml file containing components of view (edittext, button, textview). until now, i've been using setvisibility(view.gone);to hide components depending on screen user in. (for illustration in first screen have hide both textviews).

one of problems i'm facing when set phone in horizontal position components had hidden show again. don't know if hiding views ideal thing purpose.

i've thought maybe should utilize more 1 activity, shouldn't i?

i appreciate help can give me construction first app.

i recommend splitting app multiple activities/fragments. depending on how big logic each screen gets glad did later on because each activity has 1 responsibility.

look @ mail service app example. got list activity showing mails , when select 1 starts detail activity showing content of mail. each activity responsible 1 thing create each 1 easier write , maintain.

it simplifies layout definitions because each 1 contains relevant parts.

android

No comments:

Post a Comment