Code example for HandlerThread

Methods: getLooper

0
        Looper.getMainLooper().quit();
    } 
 
    @Test 
    public void shouldNotQueueMessagesIfLooperIsQuit() throws Exception { 
        HandlerThread ht = new HandlerThread("test1");
        ht.start();
        Looper looper = ht.getLooper();
        looper.quit();
        assertTrue(shadowOf(looper).hasQuit());
        assertFalse(shadowOf(looper).post(new Runnable() {
            @Override public void run() { } 
        }, 0)); 
 
        assertFalse(shadowOf(looper).postAtFrontOfQueue(new Runnable() {
            @Override 
            public void run() { 
            } 
        })); 
        assertFalse(shadowOf(looper).getScheduler().areAnyRunnable());
    }