Android background timer updating a Texview Item of Recyclerview
<p>I'm using Handler to create a countdown timer inside of Service class. 
The timer works by decreasing the remaining time 
and works by updating the Texview on which Item of Recyclerview is working. 
The problem is, when the application is closed and reopen, 
the timer will no longer able to update the Texview on which Item of Recyclerview is working.</p>

<p>From Recyclerview Adapter I'm calling the function from Service to start the timer. 
And by the help of <a href="https://github.com/greenrobot/EventBus" rel="nofollow noreferrer">Eventbus libray</a> I am able to change the Texview.</p>

<pre><code>...
@Override
public PageAdapter.TheViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    if (!EventBus.getDefault().isRegistered(this)) { //Register the EventBus library
        EventBus.getDefault().register(this);
    }
    View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.custom_item, parent, false);
    return new TheViewHolder(itemView);
}

@Override
public void onBindViewHolder(final PageAdapter.TheViewHolder holder, int position) {
    holder.btn_start_countdown.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            new ServiceHelper().startTimer(milliseconds, holder);//Call the Function in Service to Start the Timer
        }
    }
}

//The Pojo that help EventBus to post the new data
public static class CounterTextPojo {
    volatile private long duration;
    private TheViewHolder holder;
    public CounterTextPojo(long duration, TheViewHolder holder){
        this.duration = duration;
        this.holder = holder;
    }
    public long getDuration(){
        return duration;
    }
}

//EventBus function to change the Textview Duration
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(CounterTextPojo data) {
    long duration = data.getDuration();
    TheViewHolder holder =  data.getHolder();
    int seconds = (int) (duration / 1000) % 60 ;
    int minutes = (int) ((duration / (1000*60)) % 60);
    int hours   = (int) ((duration / (1000*60*60)) % 24);
    holder.durationTexview.setText(String.format("%02d:%02d:%02d",hours,minutes,seconds));

    if(duration &lt; 1){
        //Countdown Finish... Do Some staf
    }
}
</code></pre>

<p>this is the part of Service class where the timer is called.</p>

<pre><code>static Handler handler=new Handler();
...
public void startTimer(long duration, PageAdapter.TheViewHolder holder){
    ... 
    handler.postDelayed(new timer(duration, holder),0);//Call the class to start the Timer
}

static class timer implements Runnable {
    volatile PageAdapter.TheViewHolder holder;
    volatile long duration;
    public timer(long duration, PageAdapter.TheViewHolder holder){
            this.holder = holder;
            this.duration = duration;
    }

    @Override
    public void run() {
        ...
        duration -= 1000; //Remove 1 Seconds
        handler.postDelayed(this,1000); //Delay in 1 Seconds
        EventBus.getDefault().post(new PageAdapter.CounterTextPojo(duration, holder)); //Update Textview using EventBus function
    }
}
</code></pre>

<p>What is the possible way to achieve what I want?</p>