ImageView img = (ImageView)findViewById(R.drawable.sleepyhead1);

It looks like you're attempting to load an image resource from your
drawables instead of the id of your ImageView.

On Aug 21, 10:44 am, Kentai <[email protected]> wrote:
> Hello Community ^-^
>
> sorry, to bother you with something this simple, but I have just begun
> working with the language and am inclined to making mistakes all over
> the palce.
>
> After quite a few hours of reading, recoding with different approaches
> and checking, I have not managed to solve my problem, which is, that
> starting the activity causes a forced shutdown ("The Application...
> has stopped unexpectedly. please try again).
>
> I tried looking for small errors in the manifest and used xml files,
> but I didn't notice anything yet^^ maby someone here can shed some
> light on this.
>
> the files:
>
> -------[blink1.xml]-------
>
> <animation-list xmlns:android="http://schemas.android.com/apk/res/
> android"
>        android:oneshot="false">
>     <item android:drawable="@drawable/sleepyhead2"
> android:duration="300" />
>     <item android:drawable="@drawable/sleepyhead1"
> android:duration="150" />
>     <item android:drawable="@drawable/sleepyhead2"
> android:duration="100" />
>     <item android:drawable="@drawable/sleepyhead3"
> android:duration="200" />
>     <item android:drawable="@drawable/sleepyhead2"
> android:duration="400" />
>     <item android:drawable="@drawable/sleepyhead1"
> android:duration="250" />
> </animation-list>
>
> ------[ScreenActivity.java]------
>
> package com.suyasuya;
>
> import android.app.Activity;
> import android.graphics.drawable.AnimationDrawable;
> import android.os.Bundle;
> import android.widget.ImageView;
>
> public class ScreenActivity extends Activity
> {
>    public void onCreate(Bundle icicle)
>    {
>
>       super.onCreate(icicle);
>       setContentView(R.layout.app);
>
>       // Load the ImageView that will host the animation and
>       // set its background to our AnimationDrawable XML resource.
>       ImageView img = (ImageView)findViewById(R.drawable.sleepyhead1);
>       img.setBackgroundResource(R.anim.blink1);
>
>       // Get the background, which has been compiled to an
> AnimationDrawable object.
>       AnimationDrawable frameAnimation = (AnimationDrawable)
> img.getBackground();
>
>       // Start the animation (looped playback by default).
>       frameAnimation.start();
>
>    }
>
> }
>
> --------
>
> If this is not enough I can also post my R file and the Manifest.
>
> Thank you ^-^
> sy,
> Kentai

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to