android:每次单击选项卡时内存使用量都会增加(使用活动组时)
我在应用程序中使用活动组来显示选项卡。
每次我单击任何选项卡时,其总内存使用量都会增加 1 MB。而且,如果我再次进入该选项卡中的任何内部活动,其内存使用量会再次增加。
我正在使用 getLocalActivityManager() 来启动活动。
//argIntent this is my intent
//argActivityId is the id ot activity
argIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// the id is stored in an arraylist
int intListSize = arlstGroup.size();
arlstGroup.add(intListSize, argActivityId);
Window objWindow = getLocalActivityManager().startActivity(argActivityId, argIntent);
View objView = objWindow.getDecorView();
setContentView(objView);
我还使用 destroyActivity() 来销毁每个活动,但内存使用量仍在增加。
然后,我尝试在每个子活动启动时销毁 localActivityManger 中的所有活动。但问题仍然存在。
我该如何解决这个问题?
请帮我...
I am using an activity group in my application to show the tabs.
Each time when I click on any tab, its total memory usage increases by 1 MB. And also if I again go to any inner activity within that tab, its memory usage increases again.
I am using getLocalActivityManager()
to start activities.
//argIntent this is my intent
//argActivityId is the id ot activity
argIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// the id is stored in an arraylist
int intListSize = arlstGroup.size();
arlstGroup.add(intListSize, argActivityId);
Window objWindow = getLocalActivityManager().startActivity(argActivityId, argIntent);
View objView = objWindow.getDecorView();
setContentView(objView);
and also i am using destroyActivity() for destroying each activity but the memory-usage is still increaing.
Then I tried with destroying all activities from localActivityManger when each sub activity starts. The problem still remains though.
How can I solve this problem?
Please help me...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您在活动中使用大型对象(Drawables、位图等)吗?查看这篇文章以了解有关避免内存泄漏的详细信息:
http://android -developers.blogspot.de/2009/01/avoiding-memory-leaks.html
Do you use large objects (Drawables, Bitmaps etc.) in your activities? Check this article for details about avoiding memory leaks:
http://android-developers.blogspot.de/2009/01/avoiding-memory-leaks.html