Append text to a TextView datatype

后端 未结 5 1150
陌清茗
陌清茗 2021-02-05 08:39

I\'m a beginner android/java programmer and my background is primarily in C++ and C#. In C# if I have a string variable called myWord and it has a value of \"Hello\" I can appen

5条回答
  •  情歌与酒
    2021-02-05 09:11

    First letter of String is not small letter. To take a String variable in java you have to write String var;

    So, for android use following code:

    TextView displayTextView = null;
    TextView displayTextView = (TextView) findViewById(R.id.myText);
    String myWord = "Your";
    displayTextView.setText("Hello " + myword);
    

    This should work.

提交回复
热议问题