Could anyone please help me with the below java code as I want to create a image slideshow without a click of a button. I want the view flipper to automatically switch through the different iamges without a click of a button. I want it to keep on showing all the images again and again, without a click of a button. I have deleted the button in my XML file as I dont require it.

Java File Code

   
public class MainActivity extends Activity {
   
    int mFlipping = 0 ; // Initially flipping is off
    Button mButton ; // Reference to button available in the layout to start and stop the flipper
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            
            /** Click event handler for button */
            OnClickListener listener = new OnClickListener() {
   
    @Override
    public void onClick(View v) {
    ViewFlipper flipper = (ViewFlipper) findViewById(R.id.flipper1);
   
    if(mFlipping==0){
    /** Start Flipping */
    flipper.startFlipping();
    mFlipping=1;
    mButton.setText(R.string.str_btn_stop);
    }
    else{
    /** Stop Flipping */
    flipper.stopFlipping();
    mFlipping=0;
    mButton.setText(R.string.str_btn_start);
    }
    }
    };
   
    /** Getting a reference to the button available in the resource */
            mButton = (Button) findViewById(R.id.btn);
            
            /** Setting click event listner for the button */
            mButton.setOnClickListener(listener);
            
            
        }
    
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            getMenuInflater().inflate(R.menu.activity_main, menu);
            return true;
        }
    }



XML File