title: Android graphics: How does TransitionDrawable work?
body: <p>I read the documentation but I can't manage to make a transition occur. What's the flow of events supposed to be like? Who calls who? </p>
  
  <p>Suppose I wanted to have an activity call init() to draw line a, and call go to make a 5 second transition to line b. What would I have to do to this code?</p>
  
  <pre><code>public class Fun extends View
  {
      Drawable a;
      Drawable b;
      TransitionDrawable t;
      public Fun(Context context) 
      {
          super(context);
          a = new LineA();
          b = new LineB();
          Drawable ray[] =  {a,b};
          t = new TransitionDrawable( ray );
      }
  
      @Override
      protected void onDraw(Canvas canvas)
      {
          t.draw(canvas);
  
      }
  
      public void init()
      {
          t.resetTransition();
      }
  
      public void go()
      {
          t.startTransition(5000);
      }
  </code></pre>
  
  <p>Thank you!</p>