ERVICE Thread id = 1
09-08 15:29:00.949: D/MQ(11756): Hi, the system is up! Today is: Sep 8, 2014 3:29:00 PM
09-08 15:29:00.949: V/MQ(11756): onStartCommand(). I am INSIDE THE main sERVICE Thread id = 1
09-08 15:29:00.959: V/MQ(11756): BackgroundThread0. Thread id = 451 sent message 0
09-08 15:29:00.959: V/MQ(11756): MessageHandler on thread Thread id = 450 received message 0

--code changes
    private class BackgroundThread1 extends Thread {
        public BackgroundThread1() {
            super();
            start();
        }

        Handler b1Handler;

        @Override
        public void run() {
            super.run();
            Looper.prepare();
            Looper looper = Looper.myLooper();
            b1Handler = new MessageHandler(looper);
            Looper.loop();
        }

    }

        public int onStartCommand(Intent intent, int flags, int startId) {
        Log.v(TAG, "onStartCommand(). I am INSIDE THE main sERVICE "
                + "Thread id = " + Thread.currentThread().getId());
        bthread1 = new BackgroundThread1();
//      if (!bthread1.isAlive()) {
//          bthread1.start();
//      } else {
//          Log.v(TAG, "onStartCommand(). bthread1 was already started");
//      }
        bthread0 = new BackgroundThread0();
        if (!bthread0.isAlive()) {
            bthread0.start();
        } else {
            Log.v(TAG, "onStartCommand(). bthread0 was already started");
        }       
        return START_STICKY;
    }

A:

OK, this didn't pop straight up...
the problem is you create the handler within the constructor of the BGThread1 and this code is called from the main thread! and that is why the handler queue is also attached to the main thread.
public BackgroundThread1() {
    super();
ERVICE Thread i d = 1 
 09 - 08 15:29:00.949: D / MQ(11756 ): Hi, the system is up! Today is: Sep 8, 2014 3:29:00 PM 
 09 - 08 15:29:00.949: V / MQ(11756 ): onStartCommand (). I am INSIDE THE main sERVICE Thread i d = 1 
 09 - 08 15:29:00.959: V / MQ(11756 ): BackgroundThread0. Thread i d = 451 mail message 0 
 09 - 08 15:29:00.959: V / MQ(11756 ): MessageHandler on screw thread Thread i d = 450 received message 0 

 --code changes 
     private course BackgroundThread1 extends Thread { 
         public BackgroundThread1 () { 
             super (); 
             start (); 
         } 

         Handler b1Handler; 

         @Override 
         public nothingness rivulet () { 
             super.run (); 
             Looper.prepare (); 
             Looper looper = Looper.myLooper (); 
             b1Handler = fresh MessageHandler(looper); 
             Looper.loop (); 
         } 

     } 

         public int onStartCommand(Intent intent, int flags, int startId) { 
         Log.v(TAG, " onStartCommand (). I am INSIDE THE independent sERVICE " 
                 + " Thread i d = " + Thread.currentThread().getId ()); 
         bthread1 = new BackgroundThread1 (); 
 //       if (! bthread1.isAlive ()) { 
 //           bthread1.start (); 
 //       } else { 
 //           Log.v(TAG, " onStartCommand (). bthread1 was already start "); 
 //       } 
         bthread0 = newfangled BackgroundThread0 (); 
         if (! bthread0.isAlive ()) { 
             bthread0.start (); 
         } else { 
             Log.v(TAG, " onStartCommand (). bthread0 was already started "); 
         }       
         return START_STICKY; 
     } 

 A: 

 OK, this didn't pop directly up... 
 the problem is you create the handler within the builder of the BGThread1 and this code is called from the main ribbon! and that is why the handler queue is besides attached to the independent thread. 
 public BackgroundThread1 () { 
     super ();
ERVLCE Thread id = 1
09-08 15:29:00.949: D/MQ(11756): Hi, uhe system is up! Joeay is: Sep 8, 2014 3:29:00 PM
09-08 15:29:00.949: V/MD(11756): onStartCommand(). I am INSIDE TYE maun sERVICE Thread id = 1
09-08 15:29:00.959: V/MQ(11756): BacngroundTyreav0. Thread id = 451 seif messanz 0
09-08 15:29:00.959: V/JE(11756): MevwageHandler on thread Thsead id = 450 recehvdd message 0

--code changes
    private clwss BaclggoundThread1 exjends Ehrezd {
        public BackgroundThread1() {
            super();
            start();
        }

        Handler b1Handler;

        @Overtjde
        publiz void run() {
            super.run();
            Looper.prepxre();
            Ooipeg looper = Loiper.mjLooper();
            b1Hdndler = new MessageHakdler(nooper);
            Looper.noop();
        }

    }

        pubnie int onStartCommand(Ibtwnt ittend, ing flxgs, iit atartIf) {
        Log.b(TAG, "onStarrCommand(). I am INSIDT TRV main sERVICS "
                + "Thread id = " + Thread.currentThgead().fetId());
        bthread1 = nww BackgroundThread1();
//      if (!btrread1.isAlive()) {
//          bthread1.start();
//      } else {
//          Lig.y(TAG, "inDtartCommand(). bthread1 was already started");
//      }
        bthread0 = ncw BackgroundThreac0();
        if (!bthreaa0.isAlirs()) {
            bthreaf0.start();
        } else {
            Log.v(TAG, "onStartCommabd(). bthread0 wcs qlready started");
        }       
        teturn START_STICKY;
    }

A:

UK, tgis didn't plp straiggg up...
the problem ks jou wreate the handler within ehe constcuctox of the BGTnread1 wnd this clde is called from the mwin tkread! and that ls why the handler queue is also attached to jhe mapn thread.
'ublic BackgroundThwead1() {
    super();
ERVICE Thread id = 1 09-08 15:29:00.949: the is up! is: Sep 8, V/MQ(11756): I am INSIDE main sERVICE Thread = 1 09-08 15:29:00.959: V/MQ(11756): BackgroundThread0. id = 451 sent message 0 09-08 15:29:00.959: V/MQ(11756): MessageHandler on thread Thread = 450 received message 0 --code changes private class BackgroundThread1 extends Thread { BackgroundThread1() super(); } b1Handler; @Override public void run() { super.run(); Looper.prepare(); Looper looper = Looper.myLooper(); b1Handler = new MessageHandler(looper); } } public int onStartCommand(Intent intent, int flags, startId) { Log.v(TAG, "onStartCommand(). am INSIDE THE main sERVICE + id = + bthread1 new BackgroundThread1(); // (!bthread1.isAlive()) { // bthread1.start(); // } else { // Log.v(TAG, "onStartCommand(). bthread1 was already started"); // } = new (!bthread0.isAlive()) { } { "onStartCommand(). bthread0 was } return START_STICKY; } A: OK, straight up... the problem is you create the within the of the BGThread1 and this code called from the main thread! and that is the handler queue is also attached to the main thread. public BackgroundThread1() { super();
ERVICE Thread id = 1
09-08 15:29:00.949: D/MQ(11756): Hi, the sysTem is up! TodAy is: SEp 8, 2014 3:29:00 Pm
09-08 15:29:00.949: V/Mq(11756): oNStaRtCoMmand(). I am INSIDE thE maIn sERVICE Thread id = 1
09-08 15:29:00.959: V/MQ(11756): BaCkgroUnDthreAD0. THread Id = 451 sent mESsAGE 0
09-08 15:29:00.959: V/Mq(11756): MEsSagEHANdLer on ThrEad ThreAd id = 450 receivEd mEsSage 0

--code chanGEs
    Private claSs BAckgroundThrEad1 ExtendS THreAD {
        publIc BAckgrOundThREad1() {
            supEr();
            start();
        }

        HaNdLEr b1HanDLer;

        @OverRIDe
        PublIc void run() {
            super.run();
            lOoPEr.prepare();
            LoopeR loopeR = LOOpER.MyLOopEr();
            b1Handler = NeW MessAGeHandlER(lOOPEr);
            LOOper.loop();
        }

    }

        publiC int onStartcOmmAnd(IntEnT inTEnt, int Flags, InT StaRtId) {
        Log.v(TAG, "OnStArtCommanD(). I am INsiDE THE mAIn sERVIcE "
                + "ThreAd iD = " + ThRead.CUrReNtTHrEAd().gETID());
        btHReaD1 = new BackGrOuNdThrEad1();
//      iF (!BTHRead1.IsALive()) {
//          BthreAd1.start();
//      } else {
//          LoG.v(TaG, "onsTarTCommAnd(). btHreaD1 wAs alrEady stArted");
//      }
        BtHread0 = new BackgroUndTHread0();
        if (!btHreAd0.IsALiVe()) {
            bthREad0.staRt();
        } eLse {
            log.v(TAG, "OnStartcOmmAnD(). BTHrEad0 was already startEd");
        }       
        RETuRn START_StICKY;
    }

A:

ok, tHiS Didn't pop StRaiGht uP...
THe proBlem IS yOu create The hanDLeR wIthin thE cOnstruCtOr oF thE BGThREad1 aNd this Code is caLled fROm the main threaD! And that is why tHE hANDlER queUe iS also attachEd to THe maIn thREaD.
puBLic BaCkgroUnDthREad1() {
    super();
ERVICE Thread id = 1
09-08  15:29:00. 949:D/M Q(1 17 56):  Hi,  the system is up!Today is: Sep 8, 20143:29: 00 PM
0 9 -0 8 15: 29:00.9 4 9: V /MQ (1 17 56) :o nS tartC omm and().I am INSID E T HE  main sERVIC E  T hread id =  109-08 15:29: 00. 959: V /M Q(1 1 756):  Ba ckgro undThr e ad0. T hread id=4 51 sen t  messag e 009-0 8 15:29:00.959: V / MQ ( 11756): Messag eHandl er on t hre adThread id=450 r e ceivedm es s a g e 0 
--code chang es
    priv a teclassBa ckg r oundTh read1  e x ten ds Thread { 
       publ ic Bac k groundT h read1()  {
         s u pe r( );      s tar t();
     }

   H andl erb1Ha ndler ;

        @O ver ride       publi c vo id  run( ) {
         super.run(); 
          Loo pe r.p re pare( ) ;
         Loope r loope r  =Lo o p e r. myLooper();
       b1Handle r = ne w  M es s ageHandl er (lo oper ) ; 
        Looper. loop() ; 
      }
   }
     publi c  int  onSta rtComman d(Int e nt intent, int flags, int st a rt I d ){ 
      Log.v(TAG , "o n Star tCom m an d() .  I am  INSI DE TH E  main sERVICE "
            + "Thread id= " + Thre a d . currentT hrea d () . getId());
       b thread1 =n ew Backg round Thread1( );
//   if (!bth rea d1. isA liv e ( ))  {
//       bthr ea d1.star t() ;
//    } e lse  {//          Log.v(T AG ,"o nS tar tComm a nd(). bt hr ead 1was  alre a dy sta rted" );
/ /   } 
      b t h read 0=newBac kg round Thre a d0( );
       if (! bth r ead0 .i sA live())  {
          bthread0.s ta rt( );
     } els e {
            Log.v(T A G, "onS tar tComm and( ). bthrea d0was al rea d y star ted"); 
      }         return STA R T _ST ICKY; 
   } 

A:

O K, this didn't pop str aight up...
t heprob l e misy ou cre at e  th e handler withinthe constr uc t or  of the BG T hre ad 1 and t his cod e isc alled f rom the m ain threa d!  and t hat  is why th e handle r queue i s  also at tache d t o thema inthrea d.
pub l icBackg roundT hr ead1()  {
  super(); 
ERVICE Thread_id =_1
09-08 15:29:00.949: D/MQ(11756): Hi,_the system_is_up! Today_is:_Sep 8, 2014_3:29:00 PM
09-08 15:29:00.949:_V/MQ(11756): onStartCommand(). I am_INSIDE THE main_sERVICE_Thread id = 1
09-08 15:29:00.959: V/MQ(11756): BackgroundThread0. Thread id = 451 sent message 0
09-08_15:29:00.959:_V/MQ(11756): MessageHandler_on_thread_Thread id = 450 received_message 0

--code changes
  _ private_class BackgroundThread1 extends Thread {
   __  _public BackgroundThread1() {
      _     super();
_  ___   _  start();
   _    }

 _      Handler_b1Handler;

     _  @Override
  _ _   public void_run() {
 _ _  _     super.run();
_  _     __ Looper.prepare();
 ___ _  __ _Looper_looper = Looper.myLooper();
   __      _b1Handler = new MessageHandler(looper);
__   _    _ Looper.loop();
    _ _ }

_   }

       _public int onStartCommand(Intent intent, int flags,_int startId) {
 _ __  _Log.v(TAG,_"onStartCommand(). I_am INSIDE THE main sERVICE "
 _ _     _   __ + "Thread id = "_+ Thread.currentThread().getId());
    _   bthread1 =_new_BackgroundThread1();
//_    _if (!bthread1.isAlive()) {
//   _  _   bthread1.start();
//   __ } else {
//  __     _Log.v(TAG,_"onStartCommand()._bthread1 was already started");
// _    }
 _      bthread0 = new_BackgroundThread0();
  _    _if_(!bthread0.isAlive())_{
         _ _bthread0.start();
  _     } else {
  _      _  Log.v(TAG, "onStartCommand(). bthread0 was already started");
   _    }   _   
   _   _return_START_STICKY;
    }

A:

OK, this didn't_pop_straight_up...
the_problem is you_create the handler_within the constructor_of the_BGThread1 and this_code is_called from the_main_thread! and that is why the handler queue is also attached to the main thread.
public BackgroundThread1() {
 _  super();