Without going over your code all that much the first thing that stands out is that it looks like you're modifying the list in the loop as you're iterating over it.

Still I would just run it in the debugger and step through and see what is going on. If you're having trouble breaking when the failure case is happening you might want to add a bogus line to let you break on it like

if ( g1Left > 2 )
    g1Left = g1Left;    // add break point here.


On 10/30/2010 9:50 PM, acr wrote:
Anyone have any idea why when i run this for loop to add a graphic to
my screen, the first iteration coordinate get discarded if the loop
runs more than once?

  For Example, I have a column of 7 graphics in a graphic array list,
when I remove a graphic the code below runs to insert a new graphic,
and it works perfectly if there is only 1 graphic removed/added. The
problem is when I remove 2 or more graphics from the column, the first
1 that is readded get written to x0 and y0 instead of x64 y64 but the
second graphic is correctly added to x64 y128. I am using OnDraw
canvas to draw.

I am totally stumped with this one, if anyone has any insight on to
why this may be happening please HELP ME?? Thanks a bunch.

                           if(_theGrid1.size()<7){
                                int g1left = 7-_theGrid1.size();
                                        int i;
                                        for(i=1;i<=g1left;i++){
                                                x1=64;
                                                y1=i*64;
                                                
graphic.getGridCoordinates().setGrid1X(x1);
        
graphic.getGridCoordinates().setGrid1Y(y1);

                                                _theGrid1.add(0,_toAdd.get(0));
                                                
_theGrid1.get(0).setAMT(_theGrid1.get(0).getAMT()
+g1left);
                                                _toMove.add(_toAdd.get(0));

                                                _theGrid1.get(0).setMV(i+10);

                                                _toAdd.remove(_toAdd.get(0));
                                        }



--
Leigh McRae
www.lonedwarfgames.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to