android按钮 - 按下的按钮应该是洋红色

时间:2014-02-05 19:20:03

标签: android button

它关于按钮的颜色。我正在设计计算器以学习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)失败。如何识别该按钮没有存储任何值。

感谢。

0 个答案:

没有答案