Reputation: 1163
In my application I am starting two activities (TTS and animation) at the same time. My app is also facing memory issues for some users.
Is running two or more activities at the same time advisable? Will this approach consume more memory?
Please advice me.
Upvotes: 0
Views: 131
Reputation: 13015
Abilash,
Is running two or more activities at the same time advisable?
Depends on the application, but many applications will run more than one activity simultaneously. The helps to create a smooth experience for the users while allowing us developers to logical segregate unrelated pieces of code. Many tabbed applications have tabs that each contain their own Activity.
Will this approach consume more memory?
Certainly. Both Activities are active, so each one uses its own resources. The issue here is how much memory each uses independently and whether it is bigger than your allotted heap size. If both Activites together are bigger than the device's heap, you must either: a) reduce memory usage or b) separate the Activities.
Recommendations
Utilize a memory analyzer tool, such as the Eclipse Memory Analyzer. Find out the minimum heap size of the devices it is running on. (This is normally determined by Android version on the device.) Take some snapshots of a device's memory while the application is running.
Hope this helps,
FuzzicalLogic
Upvotes: 3
Reputation: 12474
Sure you can run two, three , even four or more activities at once. But it boils down to what you're doing in each thread. Take a look at Android's concurrency library for more info.
Upvotes: 1