onClick method issue

前端 未结 3 806
终归单人心
终归单人心 2021-01-14 20:22

ok, so I am going through the tutorial of the \"MyFirstApp\" on the devoloper.android.com site. I am on the last tutorial and I have did everything for the first chapter you

3条回答
  •  不知归路
    2021-01-14 21:20

    It looks like you misspelled the function name in your xml for the Button onClick(). You have an uppercase "m" in your java code

     public void sendMessage(View view) {
    

    and probably a lowercase "m" in your xml

    To comply with java standards, change it in your xml to

     android:onClick="sendMessage"/>
    

提交回复
热议问题