Twice call of timer crashes my app: Android
<p>I'm trying to develop a small android App. In that app I need to use Timer control, which will be fired at button click. What problem I'm getting is, First timer task call is working fine but when I'm calling it again my app getting crashes. Code using for timer task is:</p>

<pre><code>Timer timer = new Timer();
TimerTask refreshRam;
final Handler handler = new Handler();
refreshRam = new TimerTask() 
    {
        public void run() 
        {
            handler.post(new Runnable() 
            {
                public void run() 
                {
                    txtFreeRam.setText(String.valueOf(getFreeRam()).toString());
                }
            });
        }}; 

    }


timer.schedule(refreshRam, 400);
</code></pre>

<p>I want to call my timer task only when I'm clicking on a button. It shouldn't be repeated...
Thanks</p>
