Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TextView myText;
- String appName;
- String helloWord;
- String txt;
- myText = findViewById (R.id.mytext);
- appName = getResources().getString(R.string.app_name);
- helloWord = getResources().getString(R.string.helloWord);
- txt = myText.getText().toString();
- public void changeText(View v){
- if (txt.equals(helloWord)){
- myText.setText(appName);
- }else if(txt.equals(appName)){
- myText.setText(helloWord);
- }
- }
- public void changeText(View v){
- txt = myText.getText().toString();
- if (txt.equals(helloWord)){
- myText.setText(appName);
- }else if(txt.equals(appName)){
- myText.setText(helloWord);
- }
- }
Add Comment
Please, Sign In to add comment