nothing sepcial there, any out of memory exception thrown when you repeat the same action for several times?
in fact, the usage of heap size increases is a normal behavior. System will not do GC just when an activity is finished, it will keep your objects in memory if no GC happended.
For my case, it will keep increase (heap size), and system.gc() can't clean those objects, finally it throws out of memory runtime exception.
Did that happen to your appliaction?
vol wrote:Use what package name you will.
- Code: Select all
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class Counter extends Activity {
private static int counter = 0;
@Override
protected void onCreate(Bundle icicle) {
// TODO Auto-generated method stub
super.onCreate(icicle);
int ourCounter = counter++;
TextView view = new TextView(this);
view.setText("Counter: " + ourCounter);
setContentView(view);
}
}
Running this the first time results in 0.
Pressing back, then running again results in 1.
Pressing back, then running again results in 2.
etc.
For the sake of brevity, I haven't added any sort of buttons to call to finish(), but the effect would be the same.