原文:Toast那行提示錯誤:The method makeText(Context, CharSequence, int) in the type Toast is not applicable for the arguments (Class , String, int)

把Toast.makeText activity .class, female ,Toast.LENGTH SHORT .show 這行里面的activity.class改為activity.this makeText方法的第一個參數指的是上下文的對象,你這里上下文的對象是這個activity本身,所以寫成activity.this代表本身 ...

2012-08-17 09:02 0 15891 推薦指數:

查看詳情

Android——Toast.makeText()

  1.Toast 作用     它是android中一種簡單的消息提示框,它沒有焦點(即不能被點擊),會根據設置的時間自動消失。   2.介紹下Toast的參數      第一個參數:當前的上下文環境,,Activity中我們直接用this代替,而到了一個button ...

Fri Nov 18 04:00:00 CST 2016 0 2754
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM