animation using GIF file

Put your problem here if it does not fit any of the other categories.

animation using GIF file

Postby bins1984 » Thu Feb 28, 2008 1:18 pm

hi.............i was trying to make a splash screen....i created one splash screen using an PNG image ....
and i trued with a animated GIF file but that file is taking a a still image its not animating........it is possible to animate this way???????????
:wink: android.view.animation or i have do with this animation method?????
User avatar
bins1984
Experienced Developer
Experienced Developer
 
Posts: 67
Joined: Fri Feb 08, 2008 8:20 am
Location: India

Top

Postby plusminus » Thu Feb 28, 2008 2:38 pm

Hello bins1984,

A developer from Google said at Dec 7:
This is a known issue that is being worked on for a future release.

:roll:

Perhaps use Frame by Frame animation with the gif-file "seperated" to a series of gif.
:arrow: http://code.google.com/android/referenc ... wable.html

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

please help

Postby bins1984 » Fri Feb 29, 2008 1:15 pm

I read the link which u placed in answer and i created the file like this
spin animation
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3.  
  4.  
  5.     <frames id="@+id/selected" oneshot="false" >
  6.  
  7.       <frame drawable="@drawable/wheel" duration="50" />
  8.  
  9.       <frame drawable="@drawable/wheel1" duration="50" />
  10.  
  11.       <frame drawable="@drawable/wheel2" duration="50" />
  12.  
  13.       <frame drawable="@drawable/wheel3" duration="50" />
  14.  
  15.       <frame drawable="@drawable/wheel4" duration="50" />
  16.  
  17.    </frames>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4

and

java file like this


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. import android.app.Activity;
  2.  
  3. import android.graphics.drawable.AnimationDrawable;
  4.  
  5. import android.os.Bundle;
  6.  
  7. import android.widget.ImageView;
  8.  
  9.  
  10.  
  11. public class mysplash extends Activity {
  12.  
  13.     /** Called when the activity is first created. */
  14.  
  15.     @Override
  16.  
  17.     public void onCreate(Bundle icicle) {
  18.  
  19.         super.onCreate(icicle);
  20.  
  21.         setContentView(R.layout.main);
  22.  
  23.         ImageView img = (ImageView)findViewById(R.id.);
  24.  
  25.         img.setBackground(R.drawable.spin_animation);
  26.  
  27.    
  28.  
  29.      // Get the background, which has been compiled to an AnimationDrawable object.
  30.  
  31.         AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground();
  32.  
  33.  
  34.  
  35.         // Start the animation (looped playback by default).
  36.  
  37.         frameAnimation.start();
  38.  
  39.      
  40.  
  41.     }
  42.  
  43. }
  44.  
  45.  
Parsed in 0.033 seconds, using GeSHi 1.0.8.4



and the main file is like this

main.xml

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.    android:orientation="vertical"
  6.  
  7.    android:layout_width="fill_parent"
  8.  
  9.    android:layout_height="fill_parent">
  10.  
  11.     <ImageView android:id="@+id/spinning_wheel_image"
  12.  
  13.                 android:layout_width="wrap_content"
  14.  
  15.                 android:layout_height="wrap_content"
  16.  
  17.                 android:gravity="center"
  18.  
  19.                 android:layout_centerHorizontal="true"
  20.  
  21.                 android:src="@+id/selected" />
  22.  
  23.    
  24.  
  25.   </LinearLayout>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4



but its not executing....................and its showing error like NULL POINTER EXCEPTION....
is this code is correct..........i am not sure may be this code is fully not correct
.............please tell me how and what changes i have to for this frame animation???
any other tutorials are there for this animation topic.....using Xml and both java...........
...........if any body can help........

thanks by bins
User avatar
bins1984
Experienced Developer
Experienced Developer
 
Posts: 67
Joined: Fri Feb 08, 2008 8:20 am
Location: India

Postby plusminus » Fri Mar 07, 2008 4:35 pm

Hello bins,

the error is probably here :darrow: I'm not exactly sure, but removing the "[font=Lucida Console]+[/font]" should do the job.
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.     <ImageView android:id="@+id/spinning_wheel_image"
  2.  
  3.          android:layout_width="wrap_content"
  4.  
  5.          android:layout_height="wrap_content"
  6.  
  7.          android:gravity="center"
  8.  
  9.          android:layout_centerHorizontal="true"
  10.  
  11.          android:src="@+id/selected" /> <!-- Error here -->
Parsed in 0.001 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 bins1984 » Mon Mar 10, 2008 7:05 am

Hi...........i tried all the combination of changes.....but now its showing the error like

.......the above code only i used if anybody can currect the code please help me..[img]http://E:\untitled.JPG[/img]
User avatar
bins1984
Experienced Developer
Experienced Developer
 
Posts: 67
Joined: Fri Feb 08, 2008 8:20 am
Location: India

i am having the same problem

Postby robisen » Tue Mar 18, 2008 2:56 am

I am having the exact same problem. I suspect it is either a bug or Google has removed this feature because it seems that the frame by frame example has been removed from the sample apps as well?
robisen
Junior Developer
Junior Developer
 
Posts: 14
Joined: Thu Feb 21, 2008 10:57 pm

Top

ya, i also have the same probs.

Postby dkkundudolan » Tue Mar 18, 2008 1:36 pm

Hi,
in the coding, some error. same probs i also faced.

thanks,
Dolan.
dkkundudolan
Experienced Developer
Experienced Developer
 
Posts: 83
Joined: Mon Mar 03, 2008 12:50 pm

XML frame by frame animation is currently a know issue

Postby robisen » Tue Mar 18, 2008 4:27 pm

I did some googling last night and found out this is a know issue but 'plusminus' also discusses it here in the forums about mid way through the thread
http://www.anddev.org/problem_on_loadin ... -t667.html

so the problem is that it is currently not working in this build.
robisen
Junior Developer
Junior Developer
 
Posts: 14
Joined: Thu Feb 21, 2008 10:57 pm

ups! same problem while drawing animation.....

Postby ekambresh » Thu Mar 20, 2008 9:13 am

hey all...even i am facing same problem,...
ekambresh
ekambresh
Junior Developer
Junior Developer
 
Posts: 22
Joined: Fri Feb 08, 2008 8:54 am
Location: Bangalore

Postby bins1984 » Thu Mar 20, 2008 7:11 pm

I tried all most possible way ,what i can do.....still i didn't get any solution...I think the Documentation have some Error or we can hope that they will solve the problem in next SDK!!!!!


thanks .
bins
User avatar
bins1984
Experienced Developer
Experienced Developer
 
Posts: 67
Joined: Fri Feb 08, 2008 8:20 am
Location: India

Postby mdownie » Thu Mar 05, 2009 3:47 pm

If I'm not mistaken, I read somewhere that you cannot start an animation in onCreate. I am not really sure why this is true, but I think if you move your AnimationDrawable.start() to it's own function you should have better results.
mdownie
Junior Developer
Junior Developer
 
Posts: 20
Joined: Tue Nov 25, 2008 6:54 pm
Location: Las Vegas

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 23 guests