ScheduledExecutorService stops working after two times

I have a ScheduledExecutorService in my application to register something every 10 seconds, but it stops after two times, and I don't know why. I have the same thing in my other fragment, and his work is beautiful. but this One stops two times.

can any body Help me and tell me why his stop works

here are my codes.

  public void getInterpreterCountService() { //create new scheduler to repeat scheduleTaskExecutor2 = Executors.newScheduledThreadPool(5); // This schedule a runnable task every 10 second scheduleTaskExecutor2.scheduleAtFixedRate(new Runnable() { public void run() { Log.d(TAG, "run:"); } }, 0, 10, TimeUnit.SECONDS); } 

I called this method in onCreate of my fragment

+5
source share

All Articles