Button variable turns to null after calling method

前端 未结 4 949
不知归路
不知归路 2021-01-29 11:34

In my mainactivity I have the following snip

MainActivity.class

private Button btnx10;

@Override
protected void onCreate(Bundle savedInstanceState) {
         


        
4条回答
  •  一整个雨季
    2021-01-29 11:45

    Remove local declaration of Button again.

    Just use btnx10=(Button)findViewById(R.id.MainCOPbtn); in onCreate()

提交回复
热议问题