4

我在我的应用程序中使用活动组来显示选项卡。

每次单击任何选项卡时,其总内存使用量都会增加 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 销毁所有活动。但问题仍然存在。

我怎么解决这个问题?

请帮我...

4

1 回答 1

0

您是否在活动中使用大对象(可绘制对象、位图等)?查看这篇文章以获取有关避免内存泄漏的详细信息:

http://android-developers.blogspot.de/2009/01/avoiding-memory-leaks.html

于 2012-07-11T13:56:43.743 回答