0
I always use several (in large project with web service and everything), the ideal is to use only one or no problems use several?
0
I always use several (in large project with web service and everything), the ideal is to use only one or no problems use several?
1
Use more than one Activity
is an option and not an obligation; with the advent of Fragments
, you can have an app with a single Activity
and several Fragments
, that would effectively be the screens of your application.
As I once heard, the Activity
would be the stage and the Fragments
the actors.
An application like this behaves like a SPA (Single Page Application).
Perks:
AsyncTasks
do not depend on the obsolete method onRetainNonConfigurationInstance() (or of worse thing) so that they are not destroyed during a screen rotation or any other configuration change;0
Yes, normally each Activity dams an Android project screen.
0
You can use as many Activity as is necessary for your needs, what happens is that very large multi-screen projects require more organization and process control.
0
Better use an Activity for each screen. If you use methods to inflate another layout, you will be carrying the baggage of the previous layout, such as open database, visible keyboard, etc. It is good practice an Activity for each Layout.
Browser other questions tagged android android-activity
You are not signed in. Login or sign up in order to post.
I don’t understand what problem made you question the use of several activities. After all, one
Activity
is a component that provides a screen for user interaction, that is, in a whole application it is likely that there are several.– Paulo Rodrigues
What is recommended is that a Activity focus on a single subject/activity.
– ramaral
It is possible to have an application with a
Activity
and severalFragments
, and this can bring you advantages compared to the approach with severalActivities
.– Piovezan