안녕하세요
FrameAnimation을 이용했는데.. 거기서 효과음을 넣으려고 하는데요.
효과음을 넣으면 그림이 자꾸 끊어져요...
끊어지지 않게 하려면 어떻게 해야죠?
아래는 소스입니다.
public class FrameAnimationActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.frame_animations_layout);
ImageView imgView = (ImageView)findViewById(R.id.animationImage);
imgView.setVisibility(ImageView.VISIBLE);
imgView.setBackgroundResource(R.drawable.frame_animation);
imgView.setOnClickListener(
new Button.OnClickListener(){
public void onClick(View v)
{
String vibratorService = Context.VIBRATOR_SERVICE;
Vibrator vibrator = (Vibrator)getSystemService(vibratorService);
vibrator.vibrate(1000); // Vibrate for 1 second
parentButtonClicked(v);
}
});
}
private void parentButtonClicked(View v)
{
animate();
}
private void animate()
{
ImageView imgView = (ImageView)findViewById(R.id.animationImage);
imgView.setVisibility(ImageView.VISIBLE);
imgView.setBackgroundResource(R.drawable.frame_animation);
AnimationDrawable frameAnimation =
(AnimationDrawable) imgView.getBackground();
if (frameAnimation.isRunning())
{
frameAnimation.stop();
Music.stop(this);
}
else
{
frameAnimation.stop();
frameAnimation.start();
Music.play(this,R.raw.game);
}
imgView.setOnClickListener(
new Button.OnClickListener(){
public void onClick(View v)
{
String vibratorService = Context.VIBRATOR_SERVICE;
Vibrator vibrator = (Vibrator)getSystemService(vibratorService);
vibrator.vibrate(1000); // Vibrate for 1 second
parentButtonClicked(v);
}
});
}