Techno Talk

Search this blog

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
screen).

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:

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.

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:

{
TableRow row = (TableRow) table.getChildAt(i);
row.setLayoutAnimation(controller);
}
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:

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(R.id.TextViewTopTitle);
Animation fade1 = AnimationUtils.loadAnimation(this, R.anim.fade_in);
logo1.startAnimation(fade1);

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
custom_anim.xml.
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:

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.

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.

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.

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.

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."

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.