When I open droid I don’t want any buttons I just want a sequence of images to automatically show, each for a few seconds before it’s replaced with another image and once all the images are shown have it loop back to the first image. I am still new to droid development and I am obviously missing something. any help will be greatly appreciated.
my java file
public class Slidingpics2Activity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView image = (ImageView) findViewById(R.id.treat);
image.setBackgroundResource(R.drawable.theanime);
AnimationDrawable Anime = (AnimationDrawable) image.getBackground();
Anime.start();
}
}
I put theanime.xml file in the drawable folder
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/image1" android:duration="1000" />
<item android:drawable="@drawable/image2" android:duration="1000" />
<item android:drawable="@drawable/image3" android:duration="1000" />
<item android:drawable="@drawable/image4" android:duration="1000" />
</animation-list>
after that I mad my layout main.xml looks like this
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/treat"
android:layout_height="match_parent"
android:layout_width="match_parent"
/>
</LinearLayout>
Sound what you need is a
ViewFlipper: