2
ボタンのクリック時にアニメーションを読み込もうとします。リソースフォルダにイメージがあり、それらをロードしようとすると、それぞれのイメージにはおよそのものがあります。サイズ50kbボタンを押すとアニメーションが出ます。OutOfmemoryとして例外があります。次のコードを確認してください。どんな助けもありがとう。フレーム単位のアニメーションでjava.lang.OutOfMemoryError:ビットマップサイズがVMの予算を超過します
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
startbtn=(Button) findViewById(R.id.myStartButton);
stopbtn=(Button)findViewById(R.id.myStopButton);
startbtn.setOnClickListener(this);
stopbtn.setOnClickListener(this);
images=(ImageView) findViewById(R.id.myImageView);
images.setBackgroundResource(R.drawable.demo_animation);
AniFrame = (AnimationDrawable)images.getBackground();
}
public void onClick(View v) {
if(v.getId()==R.id.myStartButton)
{
AniFrame.start();
}else if(v.getId()==R.id.myStopButton)
{
AniFrame.stop();
}
}
ページの右側にある「関連する」質問をご覧ください。あなたはこの質問が広告のnauseumに覆われて表示されます。 –
関連する質問が表示されますが、適切な解決策は得られません。 –
+1良い質問です。 :D – mAc