Skip to content Skip to sidebar Skip to footer

Android : Draw Textedit(s) Or Textview(s) When User Enter Number Of Them.[exp: 6 Then Draw 6 Textview]

Wantto ask user to enter number of TextEdit or ViewText and then draw them. For-example user enter 7,then seven ViewText draw.I knew this is a suitable way but in my prgrm i cant c

Solution 1:

You're adding the LinearLayout to itself. The last line should be ll.addView(tv);

Solution 2:

LinearLayoutll= (LinearLayout)findViewById(R.id.myLL);
         for(int i=1 ; i<= 10 ; i++)
               {
                 TextViewtv=newTextView(getApplicationContext());
                 tv.setText("String/String/String");
                 ll.addView(tv);
               }

replace 'new TextView(new)' with 'new TextView(getApplicationContext())' .

Post a Comment for "Android : Draw Textedit(s) Or Textview(s) When User Enter Number Of Them.[exp: 6 Then Draw 6 Textview]"