Maximum amount of activities in app? Android

六眼飞鱼酱① 提交于 2019-12-30 09:36:43

问题


Is there something like maximum activities in android app? I would like to know because I am thinking to create sound app with ringtone feature. It will have roughly around 40 activities. But only 1 will be running constantly. Is that too much? Should I find another way?

Explanation why I need 40 activities I have 30 sounds and I want to set them as ringtone. 1 normal activity with buttons to play Mp and stuff, and 35 other activities, 1 for each file. What I want is to on Long click start activity with layout and there will be more buttons I tried with contextual menu but it doesn't look good.


回答1:


You shouldn't have a problem directly due to the number of activities, but I question your design. It will likely be difficult to get right and suffer performance issues and the APK will probably be very overly large.

An alternative approach could utilize the fact that you can selectively use/show different layouts for a single activity and that a single layout can selectively show different components in the the same visible space.




回答2:


You can have as many activities as you want. There is no constraint on the number. All Android activities are stored in a stack and the one at the top of the stack is the one that is visible. When memory is low, the Android OS will automatically start killing the ones that are lower down the stack and are not running any background tasks or services.



来源:https://stackoverflow.com/questions/22517099/maximum-amount-of-activities-in-app-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!