I am doing like these it is loading static these image?
public class ArchiveGroup extends Activity {
Button btn;
ViewFlipper flip;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.next);
btn=(Button)findViewById(R.id.btn);
flip=(ViewFlipper)findViewById(R.id.flip);
}
public void ClickHandler(View v)
{
flip.showNext();
}
public void ClickHandler1(View v)
{
Toast.makeText(this,"text",Toast.LENGTH_LONG).show();
}
}
i am using three imageview in ViewFlipper in xml file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Flip"
android:id="@+id/btn"
android:onClick="ClickHandler"
/>
<ViewFlipper
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/flip"
>
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
/>
</ViewFlipper>
</LinearLayout>
How to set dynamic images to these imageView. By using single ImageView.
In your xml just add only this,
need not enclose with any ImageViews.
Now do this in your coding.
Considering that you have stored your Images in a array like this,
Now in your onCreate(),
And now add this method to your activity,
That’s it. And now using your
viewFlipper.showNext();andviewFlipper.showPrevious();methods you can show your dynamic images.