0

Android : How to wait until Timer and Timertask finish their work on UI Thread

view story
linux-howto

http://stackoverflow.com – I have a fragment. In this fragment, I have a Timer that run a timertask periodically. I override onPause so when switch fragment, TimerTask and timer will stop its work. @Override public void onPause() { super.onPause(); timerTask.cancel(); timer.cancel(); timer.purge(); } And Here is my code for switching fragment : OrderFragment fragment2 = new OrderFragment(); fragment2.setArguments(arguments); getSupportFragmentManager().beginTransaction().replace(R.id.item_detail_container, fragmen (HowTos)