How to get the time difference betwwe timePicker and System Time
<p>i want to make a small alarm application. i want to calculate the time difference between the system time (current) and the time From <code>TimePicker</code>(chosen by user). i could not find  some good solution. here is my code</p>

<pre><code>@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_alarm_list);
    timePicker = (TimePicker) findViewById(R.id.timePicker1);
    timePicker.setIs24HourView(true);
    b = (Button) findViewById(R.id.button1);
    c = Calendar.getInstance();
    timePicker.setOnTimeChangedListener(new OnTimeChangedListener() {





    @Override
    public void onTimeChanged(TimePicker arg0, int hours, int minutes) {
        c.set(Calendar.HOUR_OF_DAY, hours);
        c.set(Calendar.MINUTE, minutes);

        chosenTimeMills = c.getTimeInMillis();
    }
});


b.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View arg0) {
                          Date currentDate = new Date(System.currentTimeMillis());
                c.set(Calendar.HOUR_OF_DAY,currentDate.getHours());
                c.set(Calendar.MINUTE, currentDate.getMinutes());
                systemTimeMills = c.getTimeInMillis();

                long difference  =systemTimeMills-chosenTimeMills;
                Date date = new Date(difference);
                Log.d("TAGG", "Difference is: "+date.getHours()+" Hours and "+date.getMinutes()+" minutes");



    }
});
}
</code></pre>

<p>I Would love to have an answer. Thanks,Usman!!!</p>
