0

I have a simple game, this game is about protecting baby from flies, so we must click the flies to kill it and save the baby. the flies is using imageview.

But I have a problem, I have a timer that every second create one flies, so if in level 1 is 50seconds , theres 50 imageview in my layout.

This make my program running so slow.

How to solve this problem? should I delete the imageview when its out of the layout? but what is the code? I cant use remove view because its open windows classfile editor.

Any help/tips are appreciated.

RobinHood
  • 10,897
  • 4
  • 48
  • 97
Alvin Christian
  • 153
  • 1
  • 1
  • 8

1 Answers1

0

Try this

I believe this is a very easy solution

mViewStub.setVisibility(View.GONE);

then when its removed from sight release the memory.

Community
  • 1
  • 1