'%' is *not* (despite what you may have read) the 'modulo' operator. It is the 'remainder' operator, and yes, it does return negative if the first value is negative.
See the Java Language Spec: http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#264541 I don't know how you are calculating dt or frameTime, but it would seem exactly one of them is negative, if the rest of what you write is correct. Of course, I can't think of what you'd do for dt or frameTime to be negative -- but that would appear to be where your bug lies. The difference I would expect is simply that it runs faster without the debugger, changing the timing, and reducing the value of dt -- somehow below zero. On Jan 11, 11:09 am, Fredrik Wigert <wig...@gmail.com> wrote: > Hi! > > I'm new to this group, and write because I felt that this problem was > a little hard to search for. > > My problem is that everything works fine on the device (x10 mini) when > i run through eclipse. However, when I make a signed apk, put it on > the sd-card and manually install the program, it crashes after a short > time. The LogCat says that a variable conceived by a modulo operation > gets a negative value, and is used to get an Image from a arraylist. > This is the line for the variable: > "int currentFrame = (int) (2*((dt/frameTime)%(image.size()/2)));" > > I would say that modulo can't generate a negative value, but i'm not > sure. > > Anyway, this bug won't appear ever when i'm debugging, so what happens > when I make the apk? What's the difference between the debug app and > the signed apk? > > Thank's on forehand! -- 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