title: Creating an Analog Clock based on user input
body: <p>I'm working on a Java/Android program that takes a number input (for example, hour = 7 and minutes = 30 for 7:30AM),
  and then expresses it on an Analog clock.
  (hour hand pointing to 7 and minute hand pointing to 30 minutes)</p>
  
  <p>How can this be done? Would I need a lot of image files? 
  I have no idea how to start ... thank you so much. </p>
  
  <p>Here's some code below that I wrote for Android on my Results Display page.</p>
  
  <pre><code>import android.app.Activity;
  import android.os.Bundle;
  import android.widget.TextView;
  
  public class ResultPage extends Activity {
      public static int hourMark;
      public static int hourMarkPM;
      public static int minuteMark;
      public static int time;
      public static String paddingMinute;   
      public static int age;
      public static String lifeClockDisplay;
  
      public static void calculation(int a){
          time = a * 18;
          minuteMark = (a * 18) % 60;
          hourMark = (time - minuteMark)/60;
          hourMarkPM = hourMark - 12;
          if (minuteMark &lt; 10){
              paddingMinute = "0" + String.valueOf(minuteMark);
          }
          else{
              paddingMinute = String.valueOf(minuteMark);
          }
      }
      public static void resultInputCalc() 
      {   //AM
          if (hourMark &gt;= 0 &amp;&amp; hourMark &lt; 12)
          {
              if (hourMark == 0)
              {
                  lifeClockDisplay = "12:" + paddingMinute + "AM";
              }
              else 
              {
                  lifeClockDisplay = hourMark + ":" + paddingMinute + "AM" ;
              }
          }
          //PM
          if (hourMark &gt;= 12 &amp;&amp; hourMark &lt; 24)
          {
              lifeClockDisplay = hourMarkPM + ":" + paddingMinute + "PM" ;
          }
          //Midnight
          if (hourMark == 24)
          {
              lifeClockDisplay = hourMarkPM + ":" + paddingMinute + "AM" ;
          }
      }
      public static String comments() {
          if (hourMark == 0)
          {
          return "Are you a baby? Did you open this app by accident? ;) ";
          }
           // Very early morning
          else if (hourMark &gt; 0 &amp;&amp; hourMark &lt; 6)
          { 
          return "Everyone else is pretty much sleeping."
                  + "Utilize this time well by reading and studying! No need to be in any hurry.";
          }
           // Early morning 
          else if (hourMark &gt;= 6 &amp;&amp; hourMark &lt; 9)
          {
            return "Morning has just started. It's a good time to plan out the rest of the day."
                  + "You have your whole day ahead of you. No need to be in a hurry. Just wake up and do your thing.";
          }
           // Late morning
          else if (hourMark &gt;= 9 &amp;&amp; hourMark &lt; 12)
          {
          return "It's still morning. You have time to plan out your afternoon and night. You have a plenty of time left. ";
          }
           // Noon
          else if (hourMark == 12)
          {
            return "It's lunch time. When you look back at the morning, what did you learn? How can you make afternoon and night better?";
          }
           // Afternoon
          else if (hourMark &gt; 12 &amp;&amp; hourMark &lt;= 18) 
          {
          return "This is time that everyone else is probably working. What will you choose to work on? How will you plan out your night?";
          }
           // Night
          else if (hourMark &gt; 18 &amp;&amp; hourMark &lt; 24){
          return "How do you want to spend the rest of the night? Aren't there still many things you want to do?";
          }
           // Midnight
          else {
          return "How do you want to spend the rest of the night? Aren't there still many things you want to do?";
          }    
      }
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.result);
  
          TextView resultIntroView = (TextView) findViewById(R.id.result_intro_text);
          resultIntroView.setText("Your current age is " + getIntent().getExtras().getString("theAge") + " years-old and " + "your life clock is pointing to ...");
  
          TextView intTestView = (TextView) findViewById(R.id.clock_display_view);
          age = Integer.parseInt(getIntent().getExtras().getString("theAge")); //here is the user-input for age saved
          calculation(age);
          resultInputCalc();
          intTestView.setText(lifeClockDisplay);      
          TextView commentsView = (TextView) findViewById(R.id.result_comments);
          commentsView.setText(comments());
  
      }
  
  }
  </code></pre>