How to set dynamic images to ViewFlipper in android?

In your xml just add only this, <ViewFlipper android:id=”@+id/flipper” android:layout_width=”fill_parent” android:layout_height=”wrap_content”> </ViewFlipper> need not enclose with any ImageViews. Now do this in your coding. Considering that you have stored your Images in a array like this, int gallery_grid_Images[]={R.drawable.gallery_image_1,R.drawable.gallery_image_2,R.drawable.gallery_image_3, R.drawable.gallery_image_4,R.drawable.gallery_image_5,R.drawable.gallery_image_6,R.drawable.gallery_image_7, R.drawable.gallery_image_8,R.drawable.gallery_image_9,R.drawable.gallery_image_10 }; Now in your onCreate(), viewFlipper = (ViewFlipper) findViewById(R.id.flipper); for(int i=0;i<gallery_grid_Images.length;i++) { // This will … Read more