WeChatMomentStat-Android
WeChatMomentStat-Android copied to clipboard
There are some advices for your program
Your program is interesting.But on my device, when I click share button, the program FC. In the console, I got these:
moe.chionlab.wechatmomentstat E/AndroidRuntime:
FATAL EXCEPTION: main
Process: moe.chionlab.wechatmomentstat, PID: 12892
java.lang.OutOfMemoryError
at android.graphics.Bitmap.nativeCreate(Native Method)
...
at moe.chionlab.wechatmomentstat.gui.MomentStatActivity.
generateShareImage(MomentStatActivity.java:207)
and you should release memory after you use Bitmap. Here are my advices:
- in AndroidManifest.xml
android:largeHeap="true" - in generateShareImage.java (227) add these code:
finally {
if(cs!=null){
cs.setBitmap(null);
cs=null;
}
if(dest!=null){
dest.recycle();
dest = null;
}
if(src!=null){
src.recycle();
src = null;
}
}
The memory allocated for bitmap will be free after about 20s.
Thanks for your advices. It would be great if you could create a pull request for us to solve this problem. Yeah I should have noticed the memory allocation problem.