Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void counterTimer() {
- final Handler handler = new Handler();
- final TextView TvCounter = (TextView) findViewById(R.id.Tv_tys_Counter);
- final java.util.concurrent.atomic.AtomicInteger n = new AtomicInteger(3);
- final Context ThisContext = this;
- final Runnable counter = new Runnable() {
- @Override
- public void run() {
- TvCounter.setText(Integer.toString(n.get()));
- if (n.getAndDecrement() >= 1)
- handler.postDelayed(this, 1000);
- else {
- TvCounter.setVisibility(View.GONE);
- Log.d(tag, "Inside the Else Method of counter");
- Intent calculate = new Intent(ThisContext, FourCalculation.class);
- calculate.putExtra("difficulty", mDifficulty);
- calculate.putExtra("questionType", mQuestions);
- startActivity(calculate);
- }
- }
- };
- handler.postDelayed(counter, 1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment