1
public class view extends View
{
public view(Context context)
{
super(context);
}
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawBitmap(thing1, 200, 200, null);
run();
}
public void run()
{
try {
Thread.sleep(2000);
} catch(InterruptedException ex) {
Thread.currentThread().interrupt();
}
if(tester2){
thing1=BitmapFactory.decodeResource(getResources(), R.drawable.image2);
tester2=false;
invalidate();
}
else
{
thing1=BitmapFactory.decodeResource(getResources(), R.drawable.image1);
tester2=true;
invalidate();
}
}
}
これはうまくいきますが、ログに "アプリケーションがあまりにも多くの作業をしている"というメッセージが表示され、多数のフレームがスキップされます。どのように私はこれを修正するのですか?skipped#frames ...アプリケーションがメインスレッドで作業している可能性があります。
[アプリケーションがメインスレッドであまりにも多くの作業を行っている可能性があります](http://stackoverflow.com/questions/14678593/the-application-may-be-doing-too-much-work-on) -its-main-thread) – settaratici