I'm fairly new to Android development and have a question regarding best practices for designing Activities. I have two activities that use the same layout, but their functions differ a bit. One activity is for adding new objects, while they other is for editing them.
Would it be better to separate the code into two activities or keep it in one? I see the advantages of keeping it in one activity would be that issues like checking input, same functions don't have to be duplicated. Else I'd say the disadvantage of this would be that I need to make several if statements to check which function should be applied (if the activity is shown in the add or in the edit version).
The best solution for me in this case is create an Activity with 2 Fragment. In this way you can keep the common functions in the Activity and write the specific functions in Fragments... In any case use only one Activity for me isn't the right way.