title: Why is countdownTimer is not working?
body: <p>I am trying, but unable, to create a counter that will show the remaining time in a text view after every minute. The time is not appearing, nor is there any error.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>package com.timer;
  
  import android.os.Bundle;
  import android.os.CountDownTimer;
  import android.app.Activity;
  import android.view.Menu;
  import android.widget.TextView;
  import android.widget.Toast;
  
  public class MainActivity extends Activity {
  
  TextView tv;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
  
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      tv = (TextView) findViewById(R.id.tv);
  
      CountDownTimer timer = new CountDownTimer(30000, 1000) {
  
           public void onTick(long millisUntilFinished) {
  
               int seconds = (int) (millisUntilFinished / 1000);
               tv.setText("seconds remaining: " + String.valueOf(seconds));
           }
  
           public void onFinish() {
               tv.setText("Finished!!");
           }
        };
  
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  }
  </code></pre>
  
  <p>And my main XML layout:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  tools:context=".MainActivity" &gt;
  
  &lt;TextView
      android:id="@+id/tv"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="@string/hello_world" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>