Hi, I am attempting to animate an ImageView using frame-by-frame animation. I am using the following code:
ImageView pacImageV = (ImageView) findViewById(R.id.pacAnim); pacImageV.setBackgroundResource(R.anim.pacanim); pacManCharAnim = (AnimationDrawable) pacImageV.getBackground(); ********************************* <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <android.pacman.com.PacManMainView android:id="@+id/pacman_main_view" android:layout_width="fill_parent" android:layout_height="fill_parent"/> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/gamescreen_txt" android:text="@string/hello" android:visibility="visible" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:gravity="center_horizontal" android:textColor="#88ffffff" android:textSize="24sp" android:paddingTop="400px"/> </RelativeLayout> <ImageView android:id="@+id/pacAnim" android:layout_width="20px" android:layout_height="20px" android:scaleType="center" android:src="@drawable/pac01"/> </FrameLayout> ********************************* <animation-list xmlns:android="http://schemas.android.com/apk/res/ android" android:oneshot="true"> <item android:drawable="@drawable/pac01" android:duration="200" / > <item android:drawable="@drawable/pac02" android:duration="200" / > </animation-list> ********************************* Logcat shows a null pointer exception for the pacImageV.setBackgroundResource(R.anim.pacanim) line. Perhaps I am following the example incorrectly. I am using the 1.5 sdk. Can anyone assist with this? Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

