title: How to refresh the linear layout programmatically
body: <p>My application has one <code>LinearLayout</code> that <code>LinearLayout</code> consists of the 3 <code>Linearlayouts</code> and that each linear layout has one <code>Relativelayout</code> and one linear layout(initially the visibility of these linear layouts is gone). If you click on the relative layout then the regarding linear layout will be displayed. But how to refresh the entire linear layout after clicking on the relative layout.</p>
  
  <p>Code:</p>
  
  <pre class="lang-java prettyprint-override"><code>private OnClickListener exit2Listener = new OnClickListener()
  {
      public void onClick(View v)
      {
         if(!exit2status)
         {
            if(RB_Constant.upcomingexits_obj.response.size() &gt; 1)
            {
               if(RB_Constant.upcomingexits_obj.response.get(1).listRestaurants.size() &gt; 0)
               {
                   // Create the views on the fly instead of using the ListView
                   UpcomingResultsListViewAdapter2 rbupcadapter2 = new UpcomingResultsListViewAdapter2(RB_UpcomingExits.this);
                   int numItems2 = 0;
  
                   if(RB_Constant.upcomingexits_obj.response.get(1).listRestaurants.size() &gt; 0)
                   {
                      numItems2 = RB_Constant.upcomingexits_obj.response.get(1).listRestaurants.size();
                   }
  
                   //linearLayout2
                   for(int position=0; position &lt; numItems2; position++)
                   {
                      View convertview = null;
                      convertview = rbupcadapter2.getView(position, convertview, null);
                      listLayout2.addView(convertview);
                   }
               }              
            }
            else
            {
               //toastMsg("No results!");
            }
            listLayout2.setVisibility(View.VISIBLE);
            exit2status=true;
  
            if(!exit1status || exit3status || exit4status || exit5status)
            {
               //System.out.println("exit2 GONE");
               listLayout1.setVisibility(View.GONE);
               listLayout3.setVisibility(View.GONE);
               exit1status = false;
               exit3status = false;
  
            }
  
            LLExitDetails.invalidate();
         }
         else
         {
            System.out.println("exit2 GONE");
            listLayout2.setVisibility(View.GONE);
            exit2status = false;
  
            LLExitDetails.invalidate();
         }
      }       
  };
  </code></pre>