android:每次单击选项卡时内存使用量都在增加(使用activitygroup时)

时间:2011-05-19 11:30:15

标签: android tabs memory-management activitygroup

我在我的应用程序中使用活动组来显示标签。

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

我该如何解决这个问题?

请帮帮我......

1 个答案:

答案 0 :(得分:0)

您在活动中使用大型物体(Drawables,Bitmaps等)吗?有关避免内存泄漏的详细信息,请查看此文章:

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

相关问题