Sunday, October 31, 2010

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

Thanks for the reply Miguel, Im positive I went through all of the
lines just to double check.
its getting the incorrect coordinates from the initial values of x and
y where graphic.getGridCoordinates().setGrid1Y(y) sets to.
but when I print lines via logcat to show the current
getGridCoordinates().setGrid1Y(y) they show correct coordinates when I
add the graphic but only the second graphic draws to the correct
coordinates. I feel like I tried everything and keep going in circles.


On Oct 31, 9:19 pm, Miguel Morales <therevolti...@gmail.com> wrote:
> Are you sure you are not modifying any of those values from another thread.
>
> On Oct 31, 2010 11:07 AM, "acr" <acr...@gmail.com> wrote:
>
> So, It has nothing to do with the loop if I add the images manually I
> get the very same result
>  the first graphic  is being drawn to x0 y0 in my code. what I have is
> a column of 7 graphics(_theGrid) and when I remove a graphic from it,
> a new graphic is created in _toAdd. What my code is doing taking what
> ever is in _toAdd array and adding it to _theGrid array.
>
> If I only add the first graphic, the graphic is drawn CORRECTLY to x63
> y63
>
> if I add both, the first is drawn INCORRECTLY to x0 y0, and the second
> graphic is drawn CORRECTLY to x63 y126
>
> if I add a third, the the first TWO are drawn INCORRECTLY and the last
> is drawn correctly.
>
> I have tried invalidate and postInvalidate with no success and have
> hit a wall.
>
> Can anyone here help me remedy this problem, I am totally stumped
> here :?
> I am obviously missing something Im just not sure what.
>
>                                                //FIRST GRAPHIC TO ADD FROM
> THE _toAdd ARRAY
>                                                x=63;
>                                                y=63;
>
>  graphic.getGridCoordinates().setGrid1X(x);
>
> graphic.getGridCoordinates().setGrid1Y(y);
>
> _toMove.add(_toAdd.get(0));
>
>  _theGrid.add(0,_toAdd.get(0));
>
>  _theGrid.get(0).setAMT(_theGrid.get(0).getAMT()+2);
>                                                _theGrid.get(0).setMV(11);
>
>  _toAdd.remove(_theGrid.get(0));
>
>                                                //SECOND GRAPHIC TO
> ADD FROM THE _toAdd ARRAY
>                                                x=63;
>                                                y=126;
>
>  graphic.getGridCoordinates().setGrid1X(x);
>
> graphic.getGridCoordinates().setGrid1Y(y);
>
> _toMove.add(_toAdd.get(0));
>
>  _theGrid.add(0,_toAdd.get(0));
>
>  _theGrid.get(0).setAMT(_theGrid.get(0).getAMT()+2);
>                                                _theGrid.get(0).setMV(12);
>
>  _toAdd.remove(_theGrid.get(0));
>
> I have the following running in OnDraw(Canvas canvas) non stop
>
>  bitmap = _theGrid.get(0).getBitmap();
>            gridcoords = _theGrid.get(0).getGridCoordinates();
>            canvas.drawBitmap(bitmap, gridcoords.getGrid1X(),
> gridcoords.getGrid1Y(), null);
>
> On Oct 31, 8:16 am, acr <acr...@gmail.com> wrote: > Now I even tried to
> change my loop to go throu...

--
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