I am writing an android app with java and have a fragment which must show absolutely different layouts in landscape and portrait orientations. Of course I know how to check the device orientation, but there are many initialization works that I must do in landscape case, and absolutely different initialization works in portrait case. And I do not want my code to become a heap of chaotic code with if- else statements. So I want to ask from experienced developers: What kind of code pattern must I use to handle different layouts in one fragment, maximally separate the two initialization codes, and still don't be forced to deal with a tonn of bugs? I remind that I use Java.
Aucun commentaire:
Enregistrer un commentaire