title: how to flip view by viewflipper in android?
body: <p>In android app i m using two view flipper to flip the view. I want to provide the delay between flipping the view. I am invoking the on click handler on a view flipper. Here is my code.</p>
  
  <pre><code>@Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.oldmactwo);
  
              flipper = (ViewFlipper) findViewById(R.id.jetViewflipper);
              flippercow=(ViewFlipper) findViewById(R.id.cowViewflipper);
  
              flippercow.setOnClickListener(new View.OnClickListener() {
  
                  @Override
                  public void onClick(View v) {
                      // TODO Auto-generated method stub
          Toast.makeText(getApplicationContext(), "on click method call",Toast.LENGTH_SHORT).show();              
  
          try {
              Thread.sleep(1000);
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
                      flipper.setInAnimation(inFromLeftAnimation());
                      flipper.setOutAnimation(outToLeftAnimation());
                      flipper.showPrevious();
  
                      try {
                          Thread.sleep(1000);
                      } catch (InterruptedException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      }
                      /*Thread splashThread=new Thread()
                      {
                          public void run() {
                              try {
                                  sleep(5000);
                              } catch (InterruptedException e) {
                                  // TODO: handle exception
                              }
                              finally{
                                  //splashThread.stop();
                              }
  
                          };
                      };
                      splashThread.start();*/
  
      Toast.makeText(getApplicationContext(), "delay ends",Toast.LENGTH_SHORT).show();                
                      //getcowFlipper();              
                      flippercow.setInAnimation(inFromBottomAnimation());
                      flippercow.setOutAnimation(outToTopAnimation());
                      flippercow.showNext();
                      //flipper.showPrevious();
      Toast.makeText(getApplicationContext(), "method ends",Toast.LENGTH_SHORT).show();               
  
                  }
              });
       }
  </code></pre>
  
  <p>In the above code the delay is executed first and then view flips later.</p>