android - Multiple fragments in one activity or separate activities -
I'm reading this (excellent BTW) and it states that
those pieces With layouts you can do:
Use an activity, which displays two pieces on tablets and handset devices. In this case, you will switch the pieces in the activity when necessary. For this it is necessary that the piece is not declared in the layout file, as such pieces can not be removed during the runtime.
Use different activities to host each piece on a handset. For example, when the Tablet UI uses two pieces in an activity, use the same activity for the handset, but provide an alternative layout that includes only one part. When you have to switch pieces, start another activity that hosts the other piece.
The second approach is the most flexible and generally better way to use pieces. In this case the main activity checks whether the pieces of detail are available in the layout. If there is a broad piece, then the main activity tells the piece that it should update itself if the scope of the extension is unavailable, the main activity starts a detailed activity.
It started to think because I thought that the first option would be better. (I have seen the same text on other tutorials at other places)
With the first option, you control the state one in the classroom regularly whether the orientation / device type
Another activity involves: It may be in my eyes that the code is a bit of odor, because it means that if you end up with / if other statements that one Make different activity and logic Has spread.
I am new to Android Dev I am really after the opinion. Am I missing something?
Thank you
Honestly your choice usually comes when pieces come in There was a way to create bullets and bullets for an activity, which is for the handset. The conference has changed that the handsets and tablets can use them to create more than one responsibility scene. As long as you follow solid / good oo, it should be fine. And just stay with the style chosen for your app.
Comments
Post a Comment