code: @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.animation_seeking);
          LinearLayout container = (LinearLayout) findViewById(R.id.container);
          final MyAnimationView animView = new MyAnimationView(this);
          container.addView(animView);
  
          Button starter = (Button) findViewById(R.id.startButton);
          starter.setOnClickListener(new View.OnClickListener() {
              public void onClick(View v) {
                  animView.startAnimation();
              }
          });
  
          mSeekBar = (SeekBar) findViewById(R.id.seekBar);
          mSeekBar.setMax(DURATION);
          mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
              public void onStopTrackingTouch(SeekBar seekBar) {
              }
  
              public void onStartTrackingTouch(SeekBar seekBar) {
              }
  
              public void onProgressChanged(SeekBar seekBar, int progress,
                      boolean fromUser) {
                  // prevent seeking on app creation
                  if (animView.getHeight() != 0) {
                      animView.seek(progress);
                  }
              }
          });
      }
docs: Called when the activity is first created.