title: Android: Setting time in time picker with the time shown in text view
body: <p>In my app, I am showing time in text view as 07:00 PM. On click of the text view, a time picker dialog pops up, In that time picker, I have to show exactly the same time as what is appearing in textview. But, I am not getting how to do that.  </p>
  
  <p><b>CODE</b> </p>
  
  <pre><code>SimpleDateFormat sdf = new SimpleDateFormat("HH:mm a");
          //int hr = 0;
          Date date = null;
          try 
          {
              date = sdf.parse(resDateArray[3]);
          } 
          catch (ParseException e) {
              e.printStackTrace();
          }
          final Calendar calendar = Calendar.getInstance();
          calendar.setTime(date);
          //tp is reference variable for time picker
  
          tp.setCurrentHour(calendar.get(Calendar.HOUR));
          tp.setCurrentMinute(calendar.get(Calendar.MINUTE));
  
          }//else
  </code></pre>