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 through the array and get the
> same EXACT result.. I have to be missing something here.
> Has ANYone else experienced this type of problem? or can give me some
> guidance. Thanks a bunch.
>
>                         int temp1Y=0;
>                         for(Graphic g1 : _toAdd1){
>                                 temp1Y+=1;
>                                 x1=0;
>                                 y1=temp1Y*-63;
>                                 graphic.getGridCoordinates().setGrid1X(x1);
>                         graphic.getGridCoordinates().setGrid1Y(y1);
>                         _toMove.add(g1);
>                                 _theGrid1.add(0,g1);
>                                 _theGrid1.get(0).setAMT(_toAdd1.size());
>                                 _theGrid1.get(0).setMV(temp1Y+10);
>                                 x1=0;
>                                 y1=temp1Y*-63;
>                                 graphic.getGridCoordinates().setGrid1X(x1);
>                         graphic.getGridCoordinates().setGrid1Y(y1);
>                         }
>                         _toAdd1.removeAll(_toAdd1);
>                         temp1Y=0;
>
> On Oct 31, 7:22 am, acr <acr...@gmail.com> wrote:
>
> > invalidate and postInvalidate doesn't fix the problem, VERY desperate,
> > but that's the type of response I was looking for much appreciated.
>
> > I used logcat and looked at everything if i remove/add 3 items items
> > from the array, the loop runs, it sets the coordinates through each
> > iteration, just the first 2 graphics draw to x0,y0 and the third draws
> > to the correct location.
>
> > do you or ANYone else have ANYother suggestions?
>
> > MUCH appreciated
>
> > On Oct 31, 5:27 am, Peter Webb <r.peter.w...@gmail.com> wrote:
>
> > > I'm a newb as well.
>
> > > I offer my idiot suggestion purely on the basis you sound desperate. I
> > > know that feeling.
>
> > > Have you tried calling .invalidate to force a redraw between steps, so
> > > the display and your code stay in sync?
>
> > > On Oct 31, 4:43 pm, acr <acr...@gmail.com> wrote:
>
> > > > I am totally stumped here, any insight from anyone would be greatly
> > > > appreciated. I hit a wall and am not sure what else to do.
>
> > > > On Oct 31, 12:00 am, acr <acr...@gmail.com> wrote:
>
> > > > > Thanks for the reply, I've done this and it looks like the loop is
> > > > > moving faster than the canvas can draw to the surface. which would
> > > > > explain why I get a positive result when there is only one to loop
> > > > > through and a positive result for the last in the loop. I even
> > > > > attempted to put a Thread.sleep in the mix and still no luck. I
> > > > > relatively am new to android and Java, so not quite sure how to remedy
> > > > > the problem.
>
> > > > > On Oct 30, 10:49 pm, Shawn Brown <big.coffee.lo...@gmail.com> wrote:
>
> > > > > > >                          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);
>
> > > > > > This looks fine to me.  Personally, I'd just log the values to 
> > > > > > confirm that.
>
> > > > > > As for the remaining code, I can't tell what you are doing there.
> > > > > > Personally, I'd just log the values to see what is going wrong 
> > > > > > where.
>
> > > > > > Shawn- Hide quoted text -
>
> > > > - Show quoted text -

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to