title: How to add Strings to a TextView / ScrollView?
body: <p>I am quiet new to android developing sorry!</p>
  
  <p>I want to add doctor values as Strings (first name, last name, and some others later) as one entry (I was trying to do so with Objects) to my Scroll View via a button. I know that I need a Layout and a Text View to do so but my Virtual Machine crushes. 
  As far as I understand I have to put my Text View (with the Strings) in the Layout and the Layout in the Scroll View (am I wrong?). </p>
  
  <p>I was trying several things from different websites which all provide similar solutions but nothing worked so far. I am using Android 6.0 with android studio and designed my UI with the Design View and adapted some code in the XML files.</p>
  
  <pre><code>public void addDoctor(View view) {
  
      setContentView(R.layout.activity_main);
      // standard java class Doctor
      Doctor doc = new Doctor("Foo", "Boo");
  
      // this is the ScrollView I generated with the design
      ScrollView sv = (ScrollView) this.findViewById(R.id.ScrollViewDoctor);
      TextView tv = new TextView(this);
      // trying to fix the parent problem here
      if(tv.getParent() != null) {
          ((ViewGroup)tv.getParent()).removeView(tv); // &lt;- fix
      }
      //this should be "Foo"
      tv.setText(doc.getDocName());
  
      // this is the layout I generated with the design "linlay"
      LinearLayout ll = (LinearLayout) this.findViewById(R.id.linlay);
      sv.addView(ll);
  
      //only one child object! -&gt; in the error log
      ll.addView(tv);
      setContentView(view);
  }
  </code></pre>
  
  <p>I expected the Strings of the object to appear in the Scroll View but the error log says that "ScrollView can host only one direct child" which I was trying to fix with the if statement but it does not seem to affect my code.</p>
  
  <p>Can you please help me with this. Do I miss something?</p>
  
  <p>Thank you!</p>