title: How can I get a reference of a view from a inflated layout
body: <p>I have a huge layout for my activity that i set using <code>setContentView()</code>. In that layout I have a <code>TableLayout</code>(named <code>tableLayout</code> in my Activity) that I want to populate. The rows of that TableLayout are customViews in a layout file(let's call that file <code>tablerow_layout.xml</code>). Inside this layout i have some TextViews and ImageView. What I want to do is change the content of the TextView programatically, when I create the row. This is my code:</p>
  
  <pre><code>LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View newRow = layoutInflater.inflate(R.layout.tablerow_layout, null, false);
  TextView name = (TextView) newRow. findViewById(R.id.tablerow_name);
  name.setText("THIS LINE");
  tableLayout.addView(newRow);
  </code></pre>
  
  <p>Unfortunately my app crashes when I try to change the content of the TextView. I know that I could do this using a ListView, but I usually have a small number of rows and the overhead of creating another Adapter for the ListView is preatty big.</p>
  
  <p>As @ρяσѕρєя K suggested I also tried newRow.findViewById(...) instead of findViewById(...) without any difference</p>