2011年8月26日 星期五

Android application

Reference:


Button button = (Button)findViewById(R.id.submit);


為了確保宣告的型別跟 XML 描述檔中描述的介面元件型別一致,好使程式運作正常,我們在 「findViewById」 方法前加上 「(Button)」修飾,強制將取得的資源型別設成 「button」型別。

類似flash的 toString. toXxxx 強制轉型態

沒有留言:

張貼留言