I have the following code:
scroll = (ScrollView) findViewById(R.id.scrollView1);
...
public void addItem(String str, int id) {
LinearLayout lay = new LinearLayout(this);
lay.setId(id);
TextView txt = new TextView(this);
txt.setText(str);
lay.addView(txt);
scroll.addView(lay);
}
And when i call addItem() once it's Okay, but when i call it twice or more, like this:
addItem("text1",1);
addItem("text2",2);
my app crashes :(