title: Android dynamically drawing more than 1000 text view is causing full application to not responding
body: <p>This is my function which will fetch some 1300 record from SQLite database and draw a series of text view inside the table layout. But when  this function starts executing full application is not responding for some time. Table layout is again inside a Scroll View. </p>
  
  <p>Basically I want it to load in back ground.so that remaining application is still responsive</p>
  
  <pre><code>   public void LoadAlarmNotifications() {
  
       int SerNo = 0 ;
       TextView SerNoTxtVw;
       TextView AlarmTxtVw;
       TextView TimeOccuredTxtVw;  
       TextView UploadTxtTxtVw;  
       Notificationtablelayout.setGravity(Gravity.CENTER);
  
       pastEvent_tbleList  = oDatabaseHandler.FetchPastEventDetails(sDiagnosisID);
  
       if(pastEvent_tbleList != null)
         {
              for(Pastevents_tble PEvents_tble: pastEvent_tbleList)
              {
                       final TableRow row = new TableRow(this.getApplicationContext());
                       nAlarmType          = PEvents_tble.GetAlarmID();
                       nRowID              = PEvents_tble.GetEventNo(); 
                       SerNo               = PEvents_tble.GetEventNo();
                       SetAlarmType(nAlarmType);  // Set Alarm
                       tAlarmTime          = PEvents_tble.GetStrtTime(); 
                       sUploadStatus       = PEvents_tble.GetUploadStatus();
                       row.setId(nRowID);
  
                       SerNoTxtVw      =new TextView(this.getApplicationContext());
                       AlarmTxtVw      =new TextView(this.getApplicationContext());
                       TimeOccuredTxtVw=new TextView(this.getApplicationContext());
                       UploadTxtTxtVw  =new TextView(this.getApplicationContext()); 
  
                       SerNoTxtVw.setText(Integer.toString(SerNo));
                       SerNoTxtVw.setWidth(80);
                       SerNoTxtVw.setHeight(40);
                       SerNoTxtVw.setGravity(Gravity.CENTER);
                       SerNoTxtVw.setPadding(2, 2,2,2);
                       SerNoTxtVw.setTextColor(Color.parseColor("#FFAADDFF"));
                       row.addView(SerNoTxtVw);
  
                       AlarmTxtVw.setText(sAlarmName);
                       AlarmTxtVw.setWidth(100);
                       AlarmTxtVw.setHeight(40);
                       AlarmTxtVw.setGravity(Gravity.LEFT);
                       AlarmTxtVw.setPadding(2,2,2,2);
                      // AlarmTxtVw.setBackgroundColor(Color.LTGRAY);
                       row.addView(AlarmTxtVw);
  
                       TimeOccuredTxtVw.setText(tAlarmTime);
                       TimeOccuredTxtVw.setWidth(140);
                       TimeOccuredTxtVw.setHeight(40);
                       TimeOccuredTxtVw.setGravity(Gravity.CENTER);
                       TimeOccuredTxtVw.setPadding(2,2,2,2);
                      // TimeOccuredTxtVw.setBackgroundColor(Color.LTGRAY);
                       row.addView(TimeOccuredTxtVw);
  
                       UploadTxtTxtVw.setText(sUploadStatus);
                       if(sUploadStatus.equals("Y")){
                           UploadTxtTxtVw.setText("✔");
                           UploadTxtTxtVw.setTextColor(Color.parseColor("#FF00FF00")); 
                       }
                       else if(sUploadStatus.equals("N")){
                           UploadTxtTxtVw.setText("X");
                           UploadTxtTxtVw.setTextColor(Color.parseColor("#FFFF0000")); 
                        }else
                        {
                           UploadTxtTxtVw.setText("✔");
                           UploadTxtTxtVw.setTextColor(Color.parseColor("#FFAADDFF"));
                        }
  
                       UploadTxtTxtVw.setWidth(100);
                       UploadTxtTxtVw.setHeight(40);
                       UploadTxtTxtVw.setGravity(Gravity.CENTER);
                       UploadTxtTxtVw.setPadding(2,2,2,2);
                      // UploadTxtTxtVw.setBackgroundColor(Color.LTGRAY);
                       row.addView(UploadTxtTxtVw);
  
                       Notificationtablelayout.addView(row); 
  
  
                       nProgressCounter++;
  
                       row.setOnClickListener(new OnClickListener() {
  
                  @Override
                      public void onClick(final View SelectedRowVw) {  
                            if(!bSwitchPopOpen)
                            {
  
                            }
  
                      });
              }  
  
              LoadingTxtView.setVisibility(View.GONE);
              bEpisodeLoad = true;
         } else
         {
              bEpisodeLoad = true;
              LoadingTxtView.setText("No Snapshot available...");
  
         } 
  }
  </code></pre>
  
  <p>pastEvent_tbleList size is 1335. Any idea how to optimize this. Instead of text view is there any other light control?</p>