In android I'm trying to figure out how to build a countdowntimer
<p>that sets itself from the system clock.  a countdown of time until 2am the next day. say it's 11pm when you start the app. run a 3 hour countdown on the main.xml  this is what I have so far</p>

<pre><code>import java.util.Calendar;
import java.util.GregorianCalendar;

import android.app.Activity;

public class LastCall extends Activity {

public static void main(String[] args){

    Calendar calendar = new GregorianCalendar();


      int hour = calendar.get(Calendar.HOUR);
      int minute = calendar.get(Calendar.MINUTE);
      int timelefthour = 0;
      int timeleftmin = 0;



      if(calendar.get(Calendar.AM_PM) == 1 &amp;&amp; hour != 12)

                timelefthour = (12 - hour) + 2;
                timeleftmin = 60 - minute;

      if(calendar.get(Calendar.AM_PM) == 1 &amp;&amp; hour == 12)

                    timelefthour = 13;
                    timeleftmin = 60 - minute;          

      if(calendar.get(Calendar.AM_PM) == 0 &amp;&amp; hour == 12)

                timelefthour = 1;
                timeleftmin = 60 - minute;  

      if(calendar.get(Calendar.AM_PM) == 0 &amp;&amp; hour &lt;= 2)

                timelefthour = 2 - hour;
                timeleftmin = 60 - minute;

       String lastcall = (Integer.toString(timelefthour) + " hr " + Integer.toString(timeleftmin) + " min ");
      }
    }
</code></pre>
