Countdown with textview
<p>My goal is simple:</p>

<p>In my xml file,I have a textview called: textView2.</p>

<p>What I need is a countdown,that countsdown from 15 to 0,and every time a second passes,the textview gets update(like: 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0).</p>

<p>And I will also need to get the current time from it.Something like</p>

<p>If the countdown timer is at second 14,then do this...</p>

<p>I tried this: </p>

<pre><code>   new CountDownTimer(30000, 1000) {

        public void onTick(long millisUntilFinished) {
            int j = (int) millisUntilFinished;
            TextView textic = (TextView) findViewById(R.id.textView2);
            textic.setText(j);
        }

        public void onFinish() {

        }
     }.start();
</code></pre>

<p>But the app crashes! What's wrong?!</p>

<p>Log:</p>

<p>11-01 13:09:33.029: WARN/dalvikvm(388): threadid=1: thread exiting with uncaught exception (group=0x40015560)
11-01 13:09:33.049: ERROR/AndroidRuntime(388): FATAL EXCEPTION: main
11-01 13:09:33.049: ERROR/AndroidRuntime(388): java.lang.RuntimeException: Unable to start activity ComponentInfo{think.smart/think.smart.ThinkyoursmartActivity}: java.lang.NullPointerException
11-01 13:09:33.049: ERROR/AndroidRuntime(388):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
11-01 13:09:33.049: ERROR/AndroidRuntime(388):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
11-01 13:09:33.049: ERROR/AndroidRuntime(388):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-01 13:09:33.049: ERROR/AndroidRuntime(388):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
11-01 13:09:33.049: ERROR/AndroidRuntime(388):     at android.os.Handler.dispatchMessage(Handler.java:99)
11-01 13:09:33.049: ERROR/AndroidRuntime(388):     at android.os.Looper.loop(Looper.java:123)
11-01 13:09:33.049: ERROR/AndroidRuntime(388):     at android.app.ActivityThread.main(ActivityThread.java:3683)
11-01 13:09:33.049: ERROR/AndroidRuntime(388):     at java.lang.reflect.Method.invokeNative(Native Method)
11-01 13:09:33.049: ERROR/AndroidRuntime(388):     at java.lang.reflect.Method.invoke(Method.java:507)
11-01 13:09:33.049: ERROR/AndroidRuntime(388):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-01 13:09:33.049: ERROR/AndroidRuntime(388):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-01 13:09:33.049: ERROR/AndroidRuntime(388):     at dalvik.system.NativeStart.main(Native Method)
11-01 13:09:33.049: ERROR/AndroidRuntime(388): Caused by: java.lang.NullPointerException
11-01 13:09:33.049: ERROR/AndroidRuntime(388):     at think.smart.ThinkyoursmartActivity.onCreate(ThinkyoursmartActivity.java:34)
11-01 13:09:33.049: ERROR/AndroidRuntime(388):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-01 13:09:33.049: ERROR/AndroidRuntime(388):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)</p>
