android - Screen capture causing heap to grow -


i trying take screenshot using code below:

final view rootview = getrootview(); rootview.setdrawingcacheenabled(true); bitmap bmp = bitmap.createbitmap(rootview.getdrawingcache()); rootview.setdrawingcacheenabled(false); 

once captured, storing screenshot in arraylist<bitmap>.

mreporter.addbitmap(bmp); 

the problem is, every time whole process performed heap grows large amount. how can avoid heap growing large?

my log showing info might helpful:

05-08 20:11:48.443: i/dalvikvm-heap(18497): grow heap (frag case) 31.288mb 6819856-byte allocation 

edit:

am storing max of 3 images in arraylist

you can not. everytime store new bitmap inside arraylist. can either downsampling bitmaps or can keep few bitmaps in arraylist


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -