Get text from pressed button

前端 未结 6 1564
栀梦
栀梦 2020-12-01 03:08

How can I get the text from a pressed button? (Android)

I can get the text from a button:

String buttonText = button.getText();

I c

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-01 04:01

    Try this,

    Button btn=(Button)findViewById(R.id.btn);
    String btnText=btn.getText();
    

提交回复
热议问题