Graphics refresh problem on PC Androd app simulator

Brent,

Hello World works fine.

As does my program if I comment out that one text statement.

Remind me again, which one specific line is causing the issue?

instructionText.text = “Select Launch Point”

I ran my app longer on my Android device and found it does develop a different but just as weird problem later in the code, which leads me to believe I have some kind of memory leak problem which is stomping on the code.

It just happens sooner in the simulator than on my Android device.

I found a nice tutorial on how to track down memory leak problems.

I’ll give it a try a report back.

Thanks for your help.

My memory seems to be leak free!

These lines of code appear to be causing the problem:

– Remove Grid Lines

Grid:removeSelf()

Grid = nil

Grid = display.newGroup()

My app has a grid that I draw at the start of each round.

I load the lines into a display group and at the end of each round I clear them using the above code.

I create a new display group for use in the next round in the third line.

I get no errors or warning in the output window.

If I separate the creation of the new display group from the removal of the old group by a few lines, it doesn’t cause problems.

Is there a way to flush everything in a display group without destroying it?

Hi @gmplayer,

Yes, you can remove group children with a simple “backwards” loop like this:

[lua]

for i = Grid.numChildren,1,-1 do

    local child = Grid[i]

    display.remove( child )

    child = nil

end 

[/lua]

Brent

Thanks Brent,

That makes my life easier.

The problem seems to “fixed” just by reversing the order that I create my display groups.

The display group that would only display when I moved my mouse outside the simulator window displays fine now.

From this:

Grid = display.newGroup()

directions = display.newGroup()

To this:

directions = display.newGroup()

Grid = display.newGroup()

Weird.

I’ve added another graphic to my menu and the problem has returned.

One thing I’ve noticed: The very first time I run my app and encounter the problem, I get the spinny mouse cursor that indicates windows is waiting for something…and then the program draws normally.

Just once, though.

The next time I encounter the bug, I have to move my mouse outside the simulator screen to get it to show what it has drawn.