I have bitmap displayed on the top of the screen when the app is
started up.
When clicking on the bitmap, the image should move to the bottom of
the screen.

I have read the AnimateDrawables from ApiDemos, but the animation is
done on a Drawable Object. If it can use on bitmap, it will be great!

Here is my code

public class HelloAndroid extends Activity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       BitmapAnimation tv = new BitmapAnimation(this);
       setContentView(tv);
   }

}

public class BitmapAnimation extends View{
        private Bitmap myBitmap;
        public BitmapAnimation(Context context) {
                super(context);
                BitmapFactory.Options opts = new
BitmapFactory.Options();
                opts.inScaled = false;
                myBitmap =
BitmapFactory.decodeResource(getResources(),
R.drawable.icon, opts);
        }
        protected void onDraw(Canvas canvas) {
                super.onDraw(canvas);
                canvas.drawBitmap(myBitmap, 0, 0 ,new Paint());
        public boolean onTouchEvent(MotionEvent event){
                if(event.getX() < myBitmap.getWidth() && event.getY() <
myBitmap.getHeight())
                {
                        //do animation here
                }
                return true;
        }
        }

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