[Solved] How to generate a TextView from a buttonclick event in Android Studio?


Try this out:

TextView[] tv4 = new TextView[value1];

TextView[] tv5 = new TextView[value2];

for(int i=0;i<value1;i++){
    tv4[i]=new TextView(Home.this);
    tv4[i] = new TextView(Home.this);
    tv4[i] .setText("Test 1"+i);
    tv4[i] .setTextSize(20);
    tv4[i] .setTextColor(Color.BLUE);
    RelativeLayout.LayoutParams params4 = new RelativeLayout.LayoutParams((int)ViewGroup.LayoutParams.WRAP_CONTENT, (int)ViewGroup.LayoutParams.WRAP_CONTENT);
    params4.leftMargin = 200+(i+10);
    params4.topMargin = 280;
    tv4[i] .setLayoutParams(params4);
    rR.addView(tv4[i] );
}

solved How to generate a TextView from a buttonclick event in Android Studio?