它关于按钮的颜色。我正在设计计算器以学习Android和Button的功能。
Button Lastbutton = null;
我创建的Lastbutton用于存储先前按下的值。所以第一次它是null。
if ( Lastbutton == null )
{
Toast.makeText(getApplicationContext(), " First TimeAnswer As of Now : " , Toast.LENGTH_SHORT).show();
Lastbutton = buttonToAdd; ( buttonToAdd is the button object pressed)
}
else
{
Toast.makeText(getApplicationContext(), " second TimeAnswer As of Now : " , Toast.LENGTH_SHORT).show();
--- Some calculation ----
Lastbutton = buttonToAdd; ( buttonToAdd is the button object pressed)
}
在If(LastButton == Null)失败。如何识别该按钮没有存储任何值。
感谢。