I'm relatively new to android animation and just feel a couple of things. I want to know how I can make a “man” (image) on an android. The man is an icon.IF, I use animations through the following code, the icon simply moves around the screen. How can I get the current movement.
public anima1(Context context)
{
super(context);
cloud=BitmapFactory.decodeResource(getResources(),R.drawable.androidicon);
}
protected void onDraw(Canvas canvas)
{
super.onDraw(canvas);
Rect re=new Rect();
re.set(0,0,canvas.getWidth(),canvas.getHeight());
Paint c=new Paint();
c.setColor(Color.WHITE);
c.setStyle(Paint.Style.FILL);
canvas.drawRect(re,c);
x=x+10;
if(x==canvas.getWidth())
{
y=y+10;
x=0;
}
if(y==canvas.getHeight())
{
x=0;
y=0;
}
canvas.drawBitmap(cloud, x, y,p);
invalidate();
}
source
share