If you are reading this, I want to ask you a question (obviously). So uhh, I kinda have this problem on my emulator in android studio where the text on the button is not edited. How do I solve this? the original thing (left) what it shows on the emulator (right)
CodePudding user response:
Usually you do this from the XML code
<Button
android:id="@ id/btn_addCamera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click Me!"/>
Or you can do this programmatically
Button button = findViewById(R.id.button);
button.setText("Click Me!");
CodePudding user response:
To set Button text, you can assign android:text XML attribute for Button in layout file with the required value.
To programmatically set or change Android Button text, then pass the specified string to the method Button. setText(new_string_value)