开发者

android: memory usage is increasing each time on tab click (when using activitygroup)

开发者 https://www.devze.com 2023-03-07 04:31 出处:网络
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

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 localActivityMa开发者_如何学Pythonnger when each sub activity starts. The problem still remains though.

How can I solve this problem?

Please help me...


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

0

精彩评论

暂无评论...
验证码 换一张
取 消