Need Help in Tab changed Listener?
<p>Hai Friends,
            I have implemented tab Listener, when i am clicking on the tabs it loads the data in the list view with no problem, if i click other tab options it also load fine, again if i click the first one i am getting the following the exception in my log, i do not know why i am getting this?, so please help me on this.</p>

<pre><code>     error android.view.ViewRoot$CalledFromWrongThreadException: 
Only the original thread that created a view hierarchy can touch its views.
</code></pre>

<p>The code is  </p>

<pre><code>    tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {

       @Override
       public void onTabChanged(String arg0) {

        if (arg0.equals("tab1")) {
         Log.v("Hi","Tilsan");
         BS_Main.submit.setVisibility(View.INVISIBLE);
         alt_header_text.setVisibility(View.INVISIBLE);
         header_text.setText("Articles");
         tabHost.setCurrentTab(1);
         if (temp_stat.equals("lv")) {
          Log.v("Hi+++","Tilsan");

          alt_header_text.setVisibility(View.INVISIBLE);
          back.setVisibility(View.INVISIBLE);
          //share.setVisibility(View.INVISIBLE);
          gal_lay.setVisibility(View.VISIBLE);
          //lv_movies.setVisibility(View.GONE);
          lv_movies.setVisibility(View.VISIBLE);
          url = "http://www.theblacksheeponline.com/mobile/article.php?start=1&amp;showcount=-1&amp;tag=all";
          flyurl = url;
          san_flag=true;
          new San_FirstTask().execute();


         }

        } else if (arg0.equals("tab2")) {
         BS_Main.submit.setVisibility(View.INVISIBLE);

         // visiblity();
         header_text.setText("Schools");
         alt_header_text.setVisibility(View.INVISIBLE);
         if (BS_Bars.temp_bars == 0) {
          BS_Main.submit.setVisibility(View.INVISIBLE);

          BS_Bars.lv_bardate.setVisibility(View.GONE);
          BS_Bars.lv_barlist.setVisibility(View.GONE);
          // BS_Bars.lv_barlist_details.setVisibility(View.GONE);
          BS_Bars.lv.setVisibility(View.VISIBLE);
          back.setVisibility(View.INVISIBLE);
          gal_lay.setVisibility(View.GONE);
         } else if (BS_Bars.temp_bars == 1) {
          BS_Main.submit.setVisibility(View.INVISIBLE);

          BS_Bars.lv.setVisibility(View.GONE);
          BS_Bars.lv_barlist.setVisibility(View.GONE);
          // BS_Bars.lv_barlist_details.setVisibility(View.GONE);
          BS_Bars.lv_bardate.setVisibility(View.VISIBLE);
          back.setVisibility(View.VISIBLE);
          gal_lay.setVisibility(View.GONE);

         } else if (BS_Bars.temp_bars == 2) {
          BS_Main.submit.setVisibility(View.INVISIBLE);

          BS_Bars.lv_bardate.setVisibility(View.GONE);
          BS_Bars.lv.setVisibility(View.GONE);
          BS_Bars.lv_barlist.setVisibility(View.VISIBLE);
          back.setVisibility(View.VISIBLE);
          gal_lay.setVisibility(View.GONE);

         } else if (BS_Bars.temp_bars == 3) {
          BS_Main.submit.setVisibility(View.INVISIBLE);

          BS_Bars.lv_bardate.setVisibility(View.GONE);
          BS_Bars.lv.setVisibility(View.GONE);
          BS_Bars.lv_barlist.setVisibility(View.GONE);
          back.setVisibility(View.VISIBLE);
          gal_lay.setVisibility(View.GONE);

         } else if (BS_Bars.temp_bars == 4) {
          BS_Main.submit.setVisibility(View.INVISIBLE);

          BS_Bars.lv_bardate.setVisibility(View.GONE);
          BS_Bars.lv.setVisibility(View.GONE);
          BS_Bars.lv_barlist.setVisibility(View.GONE);
          BS_Bars.bars_wv.setVisibility(View.VISIBLE);
          back.setVisibility(View.VISIBLE);
          gal_lay.setVisibility(View.GONE);

         } else {
          BS_Main.submit.setVisibility(View.INVISIBLE);

          BS_Bars.lv.setVisibility(View.VISIBLE);
          BS_Bars.lv_barlist.setVisibility(View.GONE);
          BS_Bars.lv_bardate.setVisibility(View.GONE);
          back.setVisibility(View.GONE);
          gal_lay.setVisibility(View.GONE);
         }

        } else if (arg0.equals("tab3")) {
         back.setVisibility(View.GONE);
         gal_lay.setVisibility(View.GONE);
         alt_header_text.setVisibility(View.INVISIBLE);
         header_text.setText("ShoutOuts");
         BS_Main.submit.setVisibility(View.INVISIBLE);
         tabHost.setCurrentTab(3);
         BS_Shoutout.shout_realtive.setVisibility(View.VISIBLE);
        } else if (arg0.equals("tab4")) {
         Log.v("Tag", "TAB4");
         back.setVisibility(View.GONE);
         //share.setVisibility(View.GONE);
         gal_lay.setVisibility(View.GONE);
         temp_stat1 = "imgv";
         header_text.setText("Pictures");
         alt_header_text.setVisibility(View.INVISIBLE);
         Log.v("TAG", "Pictures");
         tabHost.setCurrentTab(4);
        } else if (arg0.equals("tab5")) {
         Intent obj_intent = new Intent(BS_Main.this,
           Rss_Feed_Grid.class);
         startActivity(obj_intent);
        }
       }
      });

// Asynchronous Task class code

private class San_FirstTask extends AsyncTask&lt;Void, Void, Void&gt; {
  private final ProgressDialog dialog = new ProgressDialog(BS_Main.this);
  String san_url;
  // can use UI thread here
  protected void onPreExecute() {
   this.dialog.setMessage("Loading...");
   this.dialog.setCancelable(false);
   this.dialog.show();

  }

  @Override
  protected Void doInBackground(Void... params) {
   try {
    if(san_flag == true)
    {
     Log.v("Hai Sankar","san_flag==true");
     san_url="http://www.theblacksheeponline.com/mobile/article.php?start=1&amp;showcount=-1&amp;tag="+san_id[0];
     Log.v("SanUrl_here", san_url);
     slist = new MultiLine_Sex(BS_Main.this, san_url);
     lv_movies.addFooterView(footerView, null, true);
     footerView.setVisibility(View.VISIBLE);
     san_flag=false;
     }
    else
    {
     Log.v("Url_here", url);
     slist = new MultiLine_Sex(BS_Main.this, url);
    }

    Log.v(TAG, "progress");
   } catch (Exception e) {
    Log.v(TAG, "error " + e);
   }
   return null;
  }

  protected void onPostExecute(Void result) {

   Log.v("Hai","Inside Else in Atask");
//   footerView.setVisibility(View.VISIBLE);
//   ListView.FixedViewInfo footerInfo1 = lv_movies.new FixedViewInfo();
//   footerInfo1.isSelectable=true;
//   ArrayList&lt;ListView.FixedViewInfo&gt; footerInfos1=new ArrayList&lt;ListView.FixedViewInfo&gt;(); 
//   footerInfo1.view = footerView;
//   footerInfos1.add(footerInfo1);
//   HeaderViewListAdapter headerViewListAdapter1 = new HeaderViewListAdapter(null,footerInfos1,slist);
//   lv_movies.setAdapter(headerViewListAdapter1);
   //lv_movies.addFooterView(footerView);
   //footerView.setVisibility(View.VISIBLE);
   lv_movies.setAdapter(slist);
   slist.notifyDataSetChanged();

//   code blocked by sandher.......
//   if (san_url != null) {
//    Log.v("Hai","Inside If in Atask");
//    footerView.setVisibility(View.VISIBLE);
//    ListView.FixedViewInfo footerInfo = lv_movies.new FixedViewInfo();
//    footerInfo.isSelectable=false;
//    ArrayList&lt;ListView.FixedViewInfo&gt; footerInfos=new ArrayList&lt;ListView.FixedViewInfo&gt;(); 
//    footerInfo.view = footerView;
//    footerInfos.add(footerInfo);
//    HeaderViewListAdapter headerViewListAdapter = new HeaderViewListAdapter(null,footerInfos,slist);
//    lv_movies.setAdapter(headerViewListAdapter);
//    //lv_movies.addFooterView(footerView);
////    
////    lv_movies.addFooterView(footerView);
////    lv_movies.setAdapter(slist);
//    slist.notifyDataSetChanged();
//   }
//   else if (url != null) {
//    Log.v("Hai","Inside Else in Atask");
//    footerView.setVisibility(View.VISIBLE);
//    ListView.FixedViewInfo footerInfo1 = lv_movies.new FixedViewInfo();
//    footerInfo1.isSelectable=true;
//    ArrayList&lt;ListView.FixedViewInfo&gt; footerInfos1=new ArrayList&lt;ListView.FixedViewInfo&gt;(); 
//    footerInfo1.view = footerView;
//    footerInfos1.add(footerInfo1);
//    HeaderViewListAdapter headerViewListAdapter1 = new HeaderViewListAdapter(null,footerInfos1,slist);
//    lv_movies.setAdapter(headerViewListAdapter1);
//
//    //lv_movies.addFooterView(footerView);
//    //lv_movies.setAdapter(slist);
//    slist.notifyDataSetChanged();
//   }
   if (this.dialog.isShowing()) {
    this.dialog.dismiss();
   }
  }
 }
</code></pre>
