0

I wish to execute the stop method of newCradleLoading as soon as the systemTime equals a specific value.

Here my pseudo code:

 newtonCradleLoading.start();
    Calendar rightNow = Calendar.getInstance();
    Calendar en = Calendar.getInstance();
    en.set(2015, 10, 20, 21, 48, 00);
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String formattedDate = df.format(rightNow.getTime());
    String reqd = df.format(en.getTime());
    while (formattedDate != reqd) {
        rightNow = Calendar.getInstance();
        formattedDate = df.format(rightNow.getTime());
    }
 newtonCradleLoading.stop();

the problem is that as soon as I select the option to display this fragment , the app freezes.

The library can be found at : https://github.com/yankai-victor/Loading

To make it more clear I want to see Newton Cradle running , until systemTime equals the required time and date.

Thanks!

Aman Arora
  • 109
  • 1
  • 11

1 Answers1

0

Have you looked into AlarmManager Service?

Here's an example of how to use it on the android developer site http://developer.android.com/training/scheduling/alarms.html

Spider
  • 431
  • 7
  • 21