The text on my buttons is set in the resource files. For instance.
<Button android:id="@+id/up_button" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/up_label" />
The code above defines a button with text @string/up_label. How can I change this text in my program while the application is running.
@string/up_label
Thank.
Button myButton = (Button) findViewById(R.id.up_button); myButton.setText("my text");
maybe this will help.
Or, if you have new text in resources (which, I think, you do), you do
Button myButton = (Button) findViewById(R.id.up_button); myButton.setText(R.string.down_label);
where down_labelis the identifier of your string.
down_label
= () findViewById (R.id.up_button);
:
button.setText("This is how to change text at runtime");
Source: https://habr.com/ru/post/1771428/More articles:Objective-C list of third-party iPhone developers? - apiHow to disable the search bar for the audio controller - androidDoes the SUID / SGID bit set the SVN binary to a security risk? - securityGetting FLV duration with php - phpWhy can't Java polymorphism catch the correct method when choosing between an object and a vector? - javaHow to avoid a side request? - sqlForcing Paged Forms From Memory - vbarich: tree - programmatically install the selected node - javaFormat NSDate Problem in getting null when converting NSString to NSDate - objective-chttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1771433/android-22-emulator-fails-to-load-wi-fi-driver&usg=ALkJrhj7rBqn8tn5hDL_s_Tt_6o4A8FG2gAll Articles