Saturday, October 30, 2010

[android-developers] for loop drawing first graphics to x0 y0 if more than 1 iteration

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));
}


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

No comments:

Post a Comment