Eu fiz este exemplo do site developers:http://developer.android.com/guide/topics/graphics/drawable-animation.html#top
para executar uma animaçao ao tocar na tela
Criei
Um animation list Dentro da pasta drawable.
onde carreguei a sequencia de imagens…
Mas esta dando este erro nesta linha de codigo
(R.id.rocket_thrust)
ImageView rocketImage = (ImageView) findViewById(R.id.rocket_thrust);
[code]
package you.pack.draw;
import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.MotionEvent;
import android.widget.ImageView;
public class DrawableActivity extends Activity {
/** Called when the activity is first created. */
AnimationDrawable rocketAnimation;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView rocketImage = (ImageView) findViewById(R.id.rocket_thrust);
rocketImage.setBackgroundResource(R.drawable.rocket_thrust);
rocketAnimation = (AnimationDrawable) rocketImage.getBackground();
}
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
rocketAnimation.start();
return true;
}
return super.onTouchEvent(event);
}
}
[/code]