I want to add fadeout animation for my splash screen, that is while closing the splash screen I want to bring the fadeout animation effect.
Here are the codes which I ha
You could try to make your activity translucent... take a look at the translucent theme in the sdk
@android:style/Theme.Translucent
SWDeveloper,
While it has been about a year since I have done any Android development myself, I remember running into this exact problem with my own splash screen.
Unfortunately, for releases before 2.0, I'm fairly certain that the type of transition you want is not possible between activities. That is, in 1.5/1.6, only the built in transition animations can be used between activities.
With that being said, I seem to recall that I used view transition animations within a given activity to produce the kind of effect I was looking for. In otherwords, on my splash screen activity, fading out the initial view to just a blank white view before transitioning to the next activity. The next activity would then start on a blank white view and then fade into the actual view of the activity.
If this seems like a lot of work, you could also alternatively just include your splash screen view in your initial activity and always present it first then fade it out. All within the same activity. Using this method would probably save you time and work, but would lose you some of the modularity that comes with separating out your screens into separate activities.
The animations between views can be achieved (if I remember correctly) via the ViewFlipper widget. The android docs for it can be found here: http://developer.android.com/reference/android/widget/ViewFlipper.html
If I can get a hold of the code base of the app that I wrote, I will try to post up an example later.
Good luck!
If you're using a separate Activity for your splash screen, you can do the overridePendingTransition call that you've noted is available in Android 2+ only. You can choose to have apps that are built for 2+ do the transition and previous versions simply do the default transition:
try {
Method method = Activity.class.getMethod("overridePendingTransition", new Class[]{int.class, int.class});
method.invoke(youractivity, inanimation, outanimation);
} catch (Exception e) {
// Can't change animation, so do nothing
}
It's better to have your splash screen a part of your main Activity (see this example). When the splash screen is part of your main activity, you can simply assign the animation to the splash screen layout.