List of usage examples for android.os CountDownTimer onFinish
public abstract void onFinish();
From source file:org.messic.android.smartphone.activities.searchmessicservice.SearchMessicServiceActivity.java
public void onSearchServiceClick(View view) { this.buttonSearch.setEnabled(false); final CountDownTimer cdt = new CountDownTimer(15000, 1000) { @Override/* ww w . ja v a2 s .co m*/ public void onTick(long millisUntilFinished) { buttonSearch.setText(getString(R.string.searchMessicService_countdown_searching) + " (" + (millisUntilFinished / 1000) + getString(R.string.searchMessicService_countdown_seconds) + ")"); } @Override public void onFinish() { buttonSearch.post(new Runnable() { public void run() { buttonSearch.setEnabled(true); buttonSearch.setText(R.string.searchMessicService_searchaction); } }); presenter.cancelSearch(); } }; cdt.start(); presenter.searchMessicServices(new MessicDiscovering.SearchListener() { public boolean messicServiceFound(final MDMMessicServerInstance md) { // let's see if the instance was found already if (!rvListAdapter.existInstance(md)) { SearchMessicServiceActivity.this.runOnUiThread(new Runnable() { public void run() { lempty.setVisibility(View.GONE); if (rvListAdapter.addInstance(md)) { rvListAdapter.notifyDataSetChanged(); } } }); cdt.cancel(); cdt.onFinish(); return true; } return false; } }); }