0

I am running a frame by frame animation using sequential images in a surface view. I am declaring the activity by :

    public class myView extends SurfaceView implements SurfaceHolder.Callback 
    {
        public myView (Context paramContext, Listener paramListener)
        {
            super(paramContext);
            getHolder().addCallback(this);
           //Some Code
        }

      public void doDraw(Canvas paramCanvas, int imgpos)
      { 
            // Animation from image source using InputStream
      }

     public boolean onTouchEvent(MotionEvent paramMotionEvent)
     {     
        return super.onTouchEvent(paramMotionEvent);        
     }

    public void surfaceChanged(SurfaceHolder paramSurfaceHolder, int paramInt1, int paramInt2, int paramInt3)
    {        
            //Some Code
    }

    public void surfaceCreated(SurfaceHolder paramSurfaceHolder)
    {
             //Some code
    }


   public void surfaceDestroyed(SurfaceHolder paramSurfaceHolder)
   {
           //Some Code
   }

}

Now I am trying to implement a Listener for the Animation End event for the above using the following code :

 public static abstract interface Listener
    {   
        public abstract void onAnimationEnd();
    }

I am stuck up with the above code and can anyone suggest me how I can implement this interface in another activity, so that I can find out that the current animation is over in the Surface View Activity.

Thanks in Advance,

Tim

Timson
  • 1,337
  • 3
  • 19
  • 32

1 Answers1

0

Add

setAnimationListener

to your animation. If you are assign the animation in the form of drawable in xml file check here to know how to get the animation drawable.

Community
  • 1
  • 1
vinay kumar
  • 1,451
  • 13
  • 33
  • Hi, I am not using xml file for the animations. The images are loaded from the asset folder and are played using a runnable Thread. – Timson Jul 23 '12 at 10:14
  • all right then we can check how many times the thread is repeating, according to that we can handle the functionality. it would be bad solution but we can make through this. – vinay kumar Jul 23 '12 at 10:26