title: Trying to insert LinearLayout dynamically
body: <p>I used the below code to add a LinearLayout dynamically.</p>
  
  <pre><code> public void sendMessage02(View view){
      view.getId();
      EditText editText=(EditText)findViewById(R.id.edit_message);
      String message=editText.getText().toString();
  
      LinearLayout l=(LinearLayout)findViewById(R.id.layout_odd);
      TextView text=new TextView(this);
      text.setText(message);
      text.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
      l.addView(text);
  
      LinearLayout l2=(LinearLayout)findViewById(R.id.layout01);
      l2.addView(l);
  
  }
  </code></pre>
  
  <p>When I run my application, it emulator displays error saying the application stopped unfortunately.</p>
  
  <p>What am i doing wrong? Is there any other way of dynamically adding layouts.</p>