I need to have a frame by frame animation inside a fragment:

the animation works properly if i have it inside an activity, but inside my 
fragment it doesnt show,

public class HomeTab extends Fragment {
     AnimationDrawable animation;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        if (container == null) {

            return null;
        }


        animation = new AnimationDrawable();
        animation.addFrame(getResources().getDrawable(R.drawable.c_0), 100);
        animation.addFrame(getResources().getDrawable(R.drawable.c1), 100);
        animation.addFrame(getResources().getDrawable(R.drawable.c2), 100);
        animation.addFrame(getResources().getDrawable(R.drawable.c3), 100);
        animation.addFrame(getResources().getDrawable(R.drawable.c4), 100);
        animation.addFrame(getResources().getDrawable(R.drawable.c5), 100);
        animation.addFrame(getResources().getDrawable(R.drawable.c6), 100);
        animation.addFrame(getResources().getDrawable(R.drawable.c7), 100);
        animation.addFrame(getResources().getDrawable(R.drawable.c8), 100);
        animation.addFrame(getResources().getDrawable(R.drawable.c9), 100);
        animation.addFrame(getResources().getDrawable(R.drawable.c10), 100);
        animation.addFrame(getResources().getDrawable(R.drawable.c9), 100);
        animation.addFrame(getResources().getDrawable(R.drawable.c8), 100);
        animation.addFrame(getResources().getDrawable(R.drawable.c7), 100);
        animation.addFrame(getResources().getDrawable(R.drawable.c6), 100);
        animation.addFrame(getResources().getDrawable(R.drawable.c5), 100);
        animation.addFrame(getResources().getDrawable(R.drawable.c4), 100);
        animation.addFrame(getResources().getDrawable(R.drawable.c3), 100);
        animation.addFrame(getResources().getDrawable(R.drawable.c2), 100);
        animation.addFrame(getResources().getDrawable(R.drawable.c1), 100);

        animation.setOneShot(false);

    }


    /*class Starter implements Runnable {

        public void run() {
            animation.start();        
        }

    }

    */


}


so how to make this frame by frame animation work inside the fragment?

thanks!





-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to