Adding OnClick(View v) in a textview

后端 未结 4 411
鱼传尺愫
鱼传尺愫 2021-01-28 08:55

i have added onClick in my mainactivity for my textview and i had no errors but when i run the app it crashes saying app has stopped working even though i have no errors in my c

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-28 09:31

    the problem is here someLayout = (LinearLayout) findViewById(R.id.state2);

    you are trying to cast textview to linearlayout.

    use yourtextview = (TextView) findViewById(R.id.state2);

提交回复
热议问题