切换活动的代码:
Intent myIntent=new Intent(context,timeZones.class);
context.startActivity(myIntent);
一旦这部分代码被命中,我会在这里得到一个空指针异常(特别是第二行):
protected void onDraw(Canvas canvas) {
canvas.drawColor(Color.WHITE);
}
我尝试添加一个布尔值来阻止画布绘制任何东西:
Intent myIntent=new Intent(context,timeZones.class);
context.startActivity(myIntent);
dontDraw = true;
protected void onDraw(Canvas canvas) {
if (dontDraw == false)
{
canvas.drawColor(Color.WHITE);
}
}
使用这个布尔值,活动 timeZones 运行,但它只是被冻结。
提前致谢!