tibo-k3
Lurker
Hello everyone!
I am actually programming a video game with android, and I a have a little problem. I am using a timer to increase two integers, which are the position of my picture on a view. However, when I am using this timer, the integers are increased but the view does not refresh, even if I use the method myview.Invalidate().
This my code:
package SpaceInvader.pack;
import java.util.TimerTask;
import android.graphics.Canvas;
public class timertask extends TimerTask{
int abscisse;
int ordonnee;
MyView m;
Canvas c;
public timertask(int x, int y, MyView myview, Canvas canvas ) {
abscisse=x;
ordonnee=y;
m = myview;
c=canvas;
}
@Override
public void run() {
c.drawBitmap(m.bLogo, abscisse, ordonnee, m.mPaint);
abscisse++;
ordonnee++;
m.invalidate();
//m.refreshDrawableState();
//m.postInvalidate();
//m.forceLayout();
//m.loadLogo();
//m.requestLayout();
//m.setFocusable(true);
}
}
Thanks for your help
!
I am actually programming a video game with android, and I a have a little problem. I am using a timer to increase two integers, which are the position of my picture on a view. However, when I am using this timer, the integers are increased but the view does not refresh, even if I use the method myview.Invalidate().
This my code:
package SpaceInvader.pack;
import java.util.TimerTask;
import android.graphics.Canvas;
public class timertask extends TimerTask{
int abscisse;
int ordonnee;
MyView m;
Canvas c;
public timertask(int x, int y, MyView myview, Canvas canvas ) {
abscisse=x;
ordonnee=y;
m = myview;
c=canvas;
}
@Override
public void run() {
c.drawBitmap(m.bLogo, abscisse, ordonnee, m.mPaint);
abscisse++;
ordonnee++;
m.invalidate();
//m.refreshDrawableState();
//m.postInvalidate();
//m.forceLayout();
//m.loadLogo();
//m.requestLayout();
//m.setFocusable(true);
}
}
Thanks for your help
