onClick method issue

前端 未结 3 804
终归单人心
终归单人心 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:06

    I think you're getting the message from the intent the wrong way. EXTRA_MESSAGE is the content and message is the identifier.

    So your code on DisplayMessageActivity.java

    String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
    

    should actually be:

    String message = intent.getStringExtra(message);
    

提交回复
热议问题