Passing data through Intent and receiving it

前端 未结 2 1408
無奈伤痛
無奈伤痛 2020-12-06 03:48

I am trying to pass data through my Intent into the next activity so I can receive it and give a timer values.

Button TimerButton = (Button)findViewById(R.id         


        
相关标签:
2条回答
  • 2020-12-06 04:18
    int beefType = getIntent().getIntExtra("beefType", -1);
    
    0 讨论(0)
  • 2020-12-06 04:27

    You need to put this line:

    int beefType = getIntent().getIntExtra("beefType", 200);
    

    in the onCreate method and not as a field initializer.

    And next time - read the stacktrace before asking. If you are still stuck after reading it, attach it to youyr questioin as well.

    Good Luck!

    0 讨论(0)
提交回复
热议问题