1
image = (ImageView) findViewById(R.id.imageView16);
button = (Button) findViewById(R.id.btncheck);
final MediaPlayer true_answer = MediaPlayer.create(this,
R.raw.answer_is_true);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
true_answer.start();
if (true_answer.isPlaying()){//doesn't work
image.setBackgroundResource(R.drawable.anim);
AnimationDrawable animation = (AnimationDrawable)image.getBackground()Q;
animation.start();
}
image.setBackgroundResource(R.drawable.anim);
AnimationDrawable animation = (AnimationDrawable)image.getBackground();
animation.stop();
}
});
私は関数isRunningを使用していますか?または私は追加する必要があります。私はこの問題を解決できません。私はメディアプレイヤーの実行中にアニメーションを開始するにはどうしたらいいですか? mediaplayerが実行されていない場合、アニメーションも実行されません
あなたは私に完全なコードを書くことができます –
すべてのものをやっているところで、完全なアクティビティコードを追加してください。 –