Animation on new Intent

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

Animation on new Intent

Postby palak1302 » Thu Mar 06, 2008 2:02 pm

i want Animation when start new Intent..can someone give me some
tips to get started on implementing the animation?
palak1302
Junior Developer
Junior Developer
 
Posts: 23
Joined: Thu Jan 31, 2008 5:17 pm

Top

Postby plusminus » Fri Mar 07, 2008 12:00 am

Hello palak,

you'll find many tutorials containing code on how to receive Intents. But the easiest would probably be to use:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Intent android.app.ApplicationContext.registerReceiver(IntentReceiver receiver, IntentFilter filter)
Parsed in 0.030 seconds, using GeSHi 1.0.8.4

What is probably easier to fire the animation than defining the Receiver in XML.

Animations works like this:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <set xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.         android:shareInterpolator="true"
  6.  
  7.         android:interpolator="@android:anim/accelerate_interpolator">
  8.  
  9.        
  10.  
  11.         <scale android:fromXScale="0.0"
  12.  
  13.                 android:toXScale="1.0"
  14.  
  15.                 android:fromYScale="0.0"
  16.  
  17.                 android:toYScale="1.0"
  18.  
  19.                 android:duration="2000"/>
  20.  
  21. </set>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4

Having defined the Animation in XML, we now use it:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                 /* Load the simple 'Zoom-In' Animation and apply it to the Splash-Logo. */
  2.  
  3.                 Animation logoZoomAnimation = AnimationUtils.loadAnimation(Splash.this, R.anim.splash_zoomin);
  4.  
  5.                 logoZoomAnimation.setRepeatMode(Animation.NO_REPEAT);
  6.  
  7.                
  8.  
  9.                 this.findViewById(R.id.iv_splash_logo).startAnimation(logoZoomAnimation);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby palak1302 » Fri Mar 07, 2008 7:22 am

what will be apply in place of R.id.iv_splash_logo in

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  this.findViewById(R.id.iv_splash_logo).startAnimation(logoZoomAnimation);
Parsed in 0.034 seconds, using GeSHi 1.0.8.4
palak1302
Junior Developer
Junior Developer
 
Posts: 23
Joined: Thu Jan 31, 2008 5:17 pm

Postby plusminus » Fri Mar 07, 2008 2:27 pm

Hello palak1302,

any Class the extends View (like ImageView) and is present in the Layout set via [font=Lucida Console]setContentView()[/font] and offers an [font=Lucida Console]android:id=...[/font] .

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby palak1302 » Sat Mar 08, 2008 10:04 am

plusminus wrote:Hello palak1302,

any Class the extends View (like ImageView) and is present in the Layout set via [font=Lucida Console]setContentView()[/font] and offers an [font=Lucida Console]android:id=...[/font] .

Regards,
plusminus

actually im use in xml page Gallery
if i use android:id= in Linerlayout xml then gallery scroll no work.....other way can we do that????plz reply....
palak1302
Junior Developer
Junior Developer
 
Posts: 23
Joined: Thu Jan 31, 2008 5:17 pm

Postby plusminus » Sat Mar 08, 2008 4:45 pm

Hello palak,

Gallery is a ViewGroup and is animated another way..

Layouts (and more generally descendants of ViewGroup) can be animated using an android.view.animation.LayoutAnimationController. See ViewGroup and ApiDemos for more details. A LayoutAnimationController is associated with a regular Animation and the ViewGroup will query the controller for a copy of that Animation for each of its children. Every child will have the same animated behavior (for instance, fade in or fade out) each individual's animation will start at a different time. The role of a LayoutAnimationController is to compute the start time of each child's animation. For instance, GridLayoutAnimationController will compute the start time based on the X and Y position of a child in a GridView whereas LayoutAnimationController will simply use the index of the child in the ViewGroup. The controller lets you specify the order (normal, reverse or random) and priority of the animations (columns first, rows first or both).


Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Return to General

Who is online

Users browsing this forum: No registered users and 3 guests