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();
}
}
}
這工作正常,但我得到「應用程序可能做了太多工作」的消息在日誌中,並跳過一堆幀。我該如何解決?跳過#幀...應用程序可能在其主線程上做了太多工作。
[該應用程序可能在其主線程上做了太多工作](http://stackoverflow.com/questions/14678593/the-application-may-be-doing-too-much-work-on - 它的-主線程) – settaratici