我的应用要求用户通过多页输入(注册过程)。 由于用户更深入注册,因此我必须保持数据完整,直到用户点击“完成”。此过程涉及活动调用子活动以及调用另一个子活动的子活动。

流程如下:主 - >子活动(注册第1部分) - >子活动(part2) - >子活动(第3部分)。

此处的问题是,我有一个低内存警告从logcat和各种进程被杀死,因为用户更深入到应用程序。我已经尝试通过在活动中传递自定义对象但是通过将它们存储到MySQllite并在需要时检索它们来保存手持内存。另外一个要点是,我不处理的图像,使用的控件只是textviews,editeviews和旋转器。

我的问题是,当有多个子活动链接时,它是否有很常见的内存问题?我如何去释放记忆?自定义控件是否比预设控件显着更多的内存? (我的亨舍之一)

* 编辑 * 我发现了低内存问题的原因。它与子活动无关。罪魁祸首是我正在使用的自定义控件。我通过使用预设控件进行了测试,而是通过急剧改进应用程序的整体性能。我不再有低记忆警告,一切都正常工作。

有帮助吗?

解决方案

I dont think it is common to have memory issues with subactivities.. i have used a tab host with 5 tabs and 3-4 activities in each plus complicated methods http calls and image adapters and there were no issues (this way the activites dont call the onDestroy method but just call onPause and then onResume). try having less global variables ex. just reference the views and get their data when you press the next button to pass to other activity or something like that so that the garbage collector collects the trash. remove some of the references when onPause is called and then if you need them again just reference them again (maybe on onResume)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top