java - Android - Change class variable before onCreate -
I am new to Android development
On my main activity I have this button:
And here square (without importing) that is calling above intention intent.
Enhances public class testing activity {static string text = "test"; @ Override Protected Zero (Bundle Saved Instantstate) {Super. NET (Saved Instantstate); SetContentView (R.layout.activity_test); TextView mTextView = (TextView) Find ViewById (R.id.textView); MTextView.setText (text); } Public Zero change text (strings) {this.text = s; } @ Override protected zeros newly created (intent to intent) {super.onNewIntent}; String [] array = intent.getStringExtra ("method"). the division (":"); If (array [0] .equals ("changeText")) {changeText (array [1]); }} @ Override Public Boolean On Crate Option Menu (menu menu) {getMenuInflater (). Flood (R. menu. Test, menu); Back true; }} Actually I want to know if it is possible to change the value of string text , onCreate () . Basically each button will have a correspondent text, and I want to be able to modify that text based on that button. If it is, then what should I do / change?
Thanks in advance.
The correct way to do this is to send the string that you want it to be an extra, And assign additional variable to the intent and assign that variable to that creature function.
Comments
Post a Comment