Search this blog

Handling animation life lycle events android

Now that you are happy with your animations, you just need to make
QuizSplashActivity transition to QuizMenuActivity when the animations
are complete. To do this, you create a new Intent control to launch the
QuizMenuActivity class and call the startActivity() method. You should also
call the finish() method of QuizSplashActivity because you do not want to keep
this activity on the stack (that is, you do not want the Back button to return to this

Of your animations, the fade_in2 animation takes the longest, at 5 seconds total.
This animation is therefore the one you want to trigger your transition upon. You do so by creating an AnimationListener object, which has callbacks for the animation life cycle events: start, end, and repeat. In this case, only the onAnimationEnd() method has an interesting implementation. Here is the code to create the AnimationListener and implement the onAnimationEnd() callback:
Animation fade2 = AnimationUtils.loadAnimation(this, R.anim.fade_in2);
fade2.setAnimationListener(new AnimationListener() {
public void onAnimationEnd(Animation animation) {
startActivity(new Intent(QuizSplashActivity.this,

Now if you run the Been There, Done That! application again, either on the emulator or on the handset, you see some nice animation on the splash screen. The user then transitions smoothly to the main menu screen, which is the next screen on your to-do list.
READ MORE » Handling animation life lycle events android

How to animate all views in a Layout android

In addition to applying animations to individual View controls, you can also apply
them to each child View control within a Layout (such as TableLayout and each
TableRow), using LayoutAnimationController.
To animate View controls in this fashion, you must load the animation, create
LayoutAnimationController, configure it as necessary, and then call the layout’s
setLayoutAnimation() method. For example, the following code loads the custom_anim animation, creates a LayoutAnimationController, and then applies it to each TableRow in the TableLayout control:
Animation spinin = AnimationUtils.loadAnimation(this, R.anim.custom_anim);
LayoutAnimationController controller =new LayoutAnimationController(spinin);
TableLayout table = (TableLayout) findViewById(;
for (int i = 0; i < table.getChildCount(); i++)
TableRow row = (TableRow) table.getChildAt(i);
There is no need to call any startAnimation() method in this case because
LayoutAnimationController handles that for you. Using this method, the animation is applied to each child view, but each starts at a different time. (The default is 50% of the duration of the animation—which, in this case, would be 1 second.) This gives you the nice effect of each ImageView spinning into existence in a cascading fashion.
Stopping LayoutAnimationController animations is no different from stopping
individual animations: You simply use the clearAnimation() method. The additional lines to do this in the existing onPause() method are shown here:
TableLayout table = (TableLayout) findViewById(;
for (int i = 0; i < table.getChildCount(); i++) {
TableRow row = (TableRow) table.getChildAt(i);
READ MORE » How to animate all views in a Layout android

How to animate Specific Views in android

Animations must be applied and managed programmatically. Remember, costly
operations, such as animations, should be stopped if the application is paused for
some reason. The animation can resume when the application comes back into theforeground.
Let’s start with a simplest case: applying the fade_in animation to your title
TextView control, called TextViewTopTitle. All you need to do is retrieve an
instance of your TextView control in the onCreate() method of the
QuizSplashActivity class, load the animation resource into an Animation object,
and call the startAnimation() method of the TextView control:
TextView logo1 = (TextView) findViewById(;
Animation fade1 = AnimationUtils.loadAnimation(this, R.anim.fade_in);

When an animation must be stopped—for instance, in the onPause() method of the activity—you simply call the clearAnimation() method. For instance, the following
onPause() method demonstrates this for the corner logos:
protected void onPause() {
// Stop the animation
TextView logo1 = (TextView) findViewById(;
TextView logo2 = (TextView) findViewById(;
// ... stop other animations

READ MORE » How to animate Specific Views in android

How to add animation resources in android

For your splash screen, you need to create three custom animations in XML and
save them to the /res/anim resource directory: fade_in.xml, fade_in2.xml, and
The first animation, fade_in.xml, simply fades its target from an alpha value of 0
(transparent) to an alpha value of 1 (opaque) over the course of 2500 milliseconds, or 2.5 seconds. There is no built-in animation editor in Eclipse. The XML for the fade_in.xml animation looks like this:

<?xml version=”1.0” encoding=”utf-8” ?>

You can apply this animation to the top TextView control with your title text.
Next, you create the fade_in2.xml animation. This animation does exactly the
same thing as the fade_in animation, except that you set the startOffset attribute
to 2500 milliseconds. This means that this animation will actually take 5 seconds
total: It waits 2.5 seconds and then fades in for 2.5 seconds. Because 5 seconds
is long enough to display the splash screen, you should plan to listen for fade_in2
to complete and then transition to the main menu screen.
Finally, you need some fun animation sequence for the TableLayout graphics. In
this case, your animation set contains multiple, simultaneous operations: a rotation, some scaling, and an alpha transition. As a result, the target View spins into existence.

The custom_anim.xml file looks like this:

<?xml version=”1.0” encoding=”utf-8” ?>
android:duration=”2000” />
android:duration=”2000” />

As you can see, the rotation operation takes 2 seconds to rotate from 0 to
360 degrees, pivoting around the center of the view. The alpha operation should
look familiar; it simply fades in over the same 2-second period. Finally, the scale
operation scales from 10% to 100% over the same 2-second period. This entire animation takes 2 seconds to complete.
After you have saved all three of your animation files, you can begin to apply the
animations to specific views.

READ MORE » How to add animation resources in android

How to work with animation in android

One great way to add zing to your splash screen would be to add some animation.The Android platform supports four types of graphics animation:

Animated GIF images—Animated GIFs are self-contained graphics files with
multiple frames.

Frame-by-frame animation—The Android SDK provides a similar mechanism
for frame-by-frame animation in which the developer supplies the individual graphic frames and transitions between them (see the AnimationDrawable class).

Tweened animation—Tweened animation is a simple and flexible method of
defining specific animation operations that can then be applied to any view
or layout.

OpenGL ES—Android’s OpenGL ES API provides advanced three-dimensional
drawing, animation, lighting, and texturing capabilities.
For your application, the tweened animation makes the most sense. Android provides tweening support for alpha (transparency), rotation, scaling, and translating (moving) animations. You can create sets of animation operations do be done simultaneously, in a timed sequence, and after a delay. Thus, tweened animation is a perfect choice for your splash screen.With tweened animation, you create an animation sequence, either programmatically or by creating animation resources in the /res/anim directory. Each animation sequence needs its own XML file, but the animation may be applied to any number of View controls.
READ MORE » How to work with animation in android

Microsoft gives manufacturers a taste of Mango

Microsoft announced this morning that the next version of the Windows Phone operating system, code-named Mango, has been delivered to manufacturers, which can begin testing it on their handsets.
The move is one of the final steps before the software arrives on new phones and is delivered to existing users as a software update.
"This marks the point in the development process where we hand code to our handset and mobile-operator partners to optimize Mango for their specific phone and network configurations," Terry Myerson, Microsoft's corporate vice president of engineering for Windows phone. "Here on the Windows Phone team, we now turn to preparing for the update process." 

Multitasking in Mango, coming to Windows Phone 7 users in the fall.
READ MORE » Microsoft gives manufacturers a taste of Mango

skype for android hacked and cracked to allow 3g calling

That Skype app for Android we thought was locked down to Wi-Fi only has just been cracked a few days after its release. The .apk is provided by xeudoxus over at Droid Forums, he tweaked it to get that pesky 3G block off, and apparently its working like a charm. So now all we need is an .apk that works on the Samsung Galaxy S.
READ MORE » skype for android hacked and cracked to allow 3g calling