Slideshow Winter Holidays WallpaperTutorial how to make a slideshow, with fade in and fade out effect between pictures, in Android Studio version 1.5.

Create New Project with Application name: Slideshow Wallpaper; Minimum SDK: API9 – Android 2.3 (Gingerbread).
Add 8 pictures from computer, in project folder app->res->drawable:  picture1.jpg,  picture2.jpg, picture3.jpg, picture4.jpg, picture5.jpg,  picture6.jpg, picture7.jpg, picture8.jpg. Or download from here the pictures used in this project.
Complete code in app->res->values->strings.xml file:

<resources>
<string name="app_name">Happy Winter Holidays!</string>
</resources>

In app->res create New Directory named “anim“.
In app->res->anim create new XML file, named “fade_in” and complete the code:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:duration="2000"
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:interpolator="@android:anim/accelerate_interpolator" />
</set>

In app->res->anim create new XML file, named “fade_out” and complete the code:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:duration="2000"
android:fromAlpha="1.0"
android:toAlpha="0.0"
android:interpolator="@android:anim/accelerate_interpolator" />
</set>

In app->res->layout->activity_main.xml complete the code:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.app.toyo.slideshowwallpaper.MainActivity">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ViewFlipper
android:id="@+id/bckgrndViewFlipper1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/bckgrndImageView8"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerCrop"
android:src="@drawable/picture1" />
<ImageView
android:id="@+id/bckgrndImageView7"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerCrop"
android:src="@drawable/picture2" />
<ImageView
android:id="@+id/bckgrndImageView6"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerCrop"
android:src="@drawable/picture3" />
<ImageView
android:id="@+id/bckgrndImageView5"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerCrop"
android:src="@drawable/picture4" />
<ImageView
android:id="@+id/bckgrndImageView4"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerCrop"
android:src="@drawable/picture5" />
<ImageView
android:id="@+id/bckgrndImageView3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerCrop"
android:src="@drawable/picture6" />
<ImageView
android:id="@+id/bckgrndImageView2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerCrop"
android:src="@drawable/picture7" />
<ImageView
android:id="@+id/bckgrndImageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerCrop"
android:src="@drawable/picture8" />
</ViewFlipper>
</LinearLayout>
</RelativeLayout>

In app->java->MainActivity complete the code:

package com.app.toyo.slideshowwallpaper;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ViewFlipper;
public class MainActivity extends AppCompatActivity {
Animation fade_in, fade_out;
ViewFlipper viewFlipper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
viewFlipper = (ViewFlipper) this.findViewById(R.id.bckgrndViewFlipper1);
fade_in = AnimationUtils.loadAnimation(this,
android.R.anim.fade_in);
fade_out = AnimationUtils.loadAnimation(this,
android.R.anim.fade_out);
viewFlipper.setInAnimation(fade_in);
viewFlipper.setOutAnimation(fade_out);
//sets auto flipping
viewFlipper.setAutoStart(true);
viewFlipper.setFlipInterval(5000);
viewFlipper.startFlipping();
}
}

Tutorial Slideshow Wallpaper
Run your app in Emulator and see the best Winter Holidays Wallpaper displaying in a Slideshow with fade in and fade out effects.

Download free app from here and enjoy winter holidays!

Watch the video tutorial how to make a slideshow with fade effect in Android Studio version 1.5:

For further questions leave a message.

27 Comments

You can follow any responses to this entry through the RSS 2.0 feed.

hi
i`m new in android programming and this tutorial was very helpful for me ,
i just wanted to thank you for that
and wish all the best for your new year.
Happy new year

Thank you so much. Happy Holidays!

    thank you .
    i have a question.that would be a great pleasure if you answer to that.
    in this tutorial,what should i do if i wanted to sliding pictures smoother?
    i mean, what should i do change images smoother and having a bigger interval between fade_in and fade_out?

      In .xml files “fade_in” and “fade_out” you have to increase values to android:duration. Now is 2000, try 5000 and see if is convenient for you.

    how to image dynamically store

How can i set this viewFlipper as live wallpaper on a button click?

Thank you so much for this.

I want to know that “how to create a wallpaper app having pictures of different formats like jpg and gif with a bunch of photographs using Android studio version 1.5.1.

Thanks in advance

    Add in ViewFlipper as many ImageView as you want.

thank you
i have a question.
how can i make a wallpaper app with a button of “Set as a wallpaper” and an other button who contain a pic with 4 tiles
Thanks in advance.

gracias, es muy simple tu codigo, lo que lo hace muy facil de leer.

thanks, is very easy you cod, what do very easy to learn.

pd: mi ingles es muy basico , XD

great tutorial

thank you so much sir.this tutorial is very help full.

Excellent Tutorial.

Keep up the good work.

I wanted to know if I can use the pictureView places viewflipper
Thinks

thanks so much for the tutorial
but i have a problem
i make every thing same u but when try to run the app give me unfortunately , has stopped
please help me
thanks again

thanks very helpful. now i want to create a photo wallpaper using photos in the phone gallery,how do i go about it

mam its not working for me. Working on this from last 4 days I am trying to find the errors done by me still not found any solution

– (“_”)beginner 🙁

it is showing me error in main_activity.java ” cannot resolve symbol R” can u help?

bro, i am getting java.lang.outofmemory error,, can you give me any kind of solution?

Can you please tell me how to create same things using the fragment?? The slide show of image should occur in the top fragment and in the bottom fragment it should display the information related to it. If i get its sample code it will be helpful for me.

thank you for your post it is very helpful

Thank you for the tutorial.
Very usefull.
I want to know how to install apk permanently in android device as wallpaper background?

bro mera application automatic bhar ajara

build successful but app cannot run open and automatically exit…

Thanks, it helped me a lot

Leave a Reply

Your email address will not be published. Required fields are marked *

Blue Captcha Image Refresh

*